whyczyk
2022-02-24 4f7c5be81febfa5f61013f021182e2725ff63511
监听传值开启关闭socket
2个文件已修改
29 ■■■■■ 已修改文件
src/components/charts/latticeBar.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/exhibition.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/charts/latticeBar.vue
@@ -287,6 +287,14 @@
            this.websock.closeMyself()
            this.websock = null
            window.removeEventListener('resize', this.resize);
        },
        stop() {
            this.websock.status = "close"
            this.websock.stop()
        },
        open() {
            this.websock.status = "start"
            this.websock.start()
        }
    },
    mounted() {
src/pages/exhibition.vue
@@ -41,7 +41,8 @@
            screenTitleBg: null,
            screenBg: null,
            isHeader: true,
            isNow: true
            isNow: true,
            state: 1,
        }
    },
    mounted() {
@@ -110,6 +111,24 @@
                        }, 0)
                    })
                    window.addEventListener("message", (msg) => {
                        // 处理数据
                        this.state = msg.data.state
                        if (this.state == 1) {
                            this.modularArr.map(item => {
                                if (item.postData) {
                                    item.postData()
                                }
                            })
                        } else if (this.state == 0) {
                            this.modularArr.map(item => {
                                if (item.outClear) {
                                    item.outClear()
                                }
                            })
                        }
                    });
                }
            }).catch((err) => {
                console.log(err)