'admin-22.11.17:优化v2.3.0版本iframe右键菜单刷新及loading'

This commit is contained in:
lyt 2022-11-17 01:18:18 +08:00
parent 32e2d6cf94
commit f00fc0d2f1

View File

@ -51,12 +51,8 @@ export default defineComponent({
const getRoutePath = computed(() => { const getRoutePath = computed(() => {
return route.path; return route.path;
}); });
// iframe iframe // iframe loading
watch( const closeIframeLoading = (val: string, item: any) => {
() => route.fullPath,
(val) => {
const item: any = props.list.find((v: any) => v.path === val);
if (item && !item.meta.isIframeOpen) item.meta.isIframeOpen = true;
nextTick(() => { nextTick(() => {
if (!iframeRef.value) return false; if (!iframeRef.value) return false;
iframeRef.value.forEach((v: any) => { iframeRef.value.forEach((v: any) => {
@ -67,6 +63,14 @@ export default defineComponent({
} }
}); });
}); });
};
// iframe iframe
watch(
() => route.fullPath,
(val) => {
const item: any = props.list.find((v: any) => v.path === val);
if (item && !item.meta.isIframeOpen) item.meta.isIframeOpen = true;
closeIframeLoading(val, item);
}, },
{ {
immediate: true, immediate: true,
@ -78,8 +82,10 @@ export default defineComponent({
() => { () => {
const item: any = props.list.find((v: any) => v.path === route.path); const item: any = props.list.find((v: any) => v.path === route.path);
if (item && item.meta.isIframeOpen) item.meta.isIframeOpen = false; if (item && item.meta.isIframeOpen) item.meta.isIframeOpen = false;
nextTick(() => { setTimeout(() => {
item.meta.isIframeOpen = true; item.meta.isIframeOpen = true;
item.meta.loading = true;
closeIframeLoading(route.fullPath, item);
}); });
}, },
{ {