1
lzhe
2024-06-21 9c094a1fe3e1ae3dadef6433f8401818fe2b8304
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export default {
    state: {
        iframeList: []
    },
    mutations: {
        setIframeList(state, route){
            state.iframeList = []
            state.iframeList.push(route)
        },
        pushIframeList(state, route){
            let target = state.iframeList.find((item) => item.path === route.path)
            if(!target){
                state.iframeList.push(route)
            }
        },
        removeIframeList(state, route){
            state.iframeList.forEach((item, index) => {
                if (item.path === route.path){
                    state.iframeList.splice(index, 1)
                }
            })
        },
        refreshIframe(state, route){
            state.iframeList.forEach((item) => {
                if (item.path == route.path){
                    var url = route.meta.url;
                    item.meta.url = '';
                    setTimeout(function() {
                        item.meta.url = url
                    }, 200);
                }
            })
        },
        clearIframeList(state){
            state.iframeList = []
        }
    }
}