+
@@ -54,25 +58,38 @@ export default {
path: [],
player: "",
visible: false,
- modelData: [],
- vlcz: null
+ modelData: []
};
},
inject: ['reload'],
mounted() {
console.log('index mounted执行了')
this.getRealTimeList()
+ if (sessionStorage.getItem('tabKey') == null) {
+ sessionStorage.setItem('tabKey', 0)
+ }
+ this.tabKey = sessionStorage.getItem('tabKey')
},
destroyed(){
-
+ if (this.$refs.vlc) {
+ for (var i = 0; i < this.$refs.vlc.length; i++) {
+ this.$refs.vlc[i].playlist.stop();
+ }
+ }
},
beforeRouteLeave(to,form,next) {
- if (this.vlcz.playlist) {
- this.vlcz.playlist.stop();
- next(true)
- } else {
- next(true)
- }
+ // console.log(11111111111111)
+ console.log(this.$refs.vlc)
+ this.$nextTick(() => {
+ if (this.$refs.vlc) {
+ for (var i = 0; i < this.$refs.vlc.length; i++) {
+ this.$refs.vlc[i].playlist.stop();
+ }
+ next(true)
+ } else {
+ next(true)
+ }
+ })
console.log('beforeRouteLeave')
},
methods: {
@@ -100,20 +117,28 @@ export default {
playVideo(id, rtsp) {
// 设置url 播放 ---添加到事件队列在下一个tick执行,避免 TypeError: t.module.postMessage is not a function
this.$nextTick(() => {
- var vlc = document.getElementById(`${id}`);
- var options = new Array(":network-caching=100");//减少延迟
- var vlcItem = vlc.playlist.add(`${rtsp}`, `${id}`, options);
- // vlc.playlist.play()
- vlc.playlist.playItem(vlcItem);
- return this.vlcz = vlc
+ setTimeout(function () {
+ var vlc = document.getElementById(`${id}`);
+ var options = new Array(":network-caching=100");//减少延迟
+ var vlcItem = vlc.playlist.add(`${rtsp}`, `${id}`, options);
+ // vlc.playlist.play()
+ vlc.playlist.playItem(vlcItem);
+ console.log(22222222222222)
+ console.log(vlc)
+ }, 500)
+
})
},
tabsChange(key) {
console.log(key)
+ sessionStorage.setItem('tabKey', key)
+ this.reload()
},
showModel(item) {
console.log(item)
- this.$router.push({name: "realTimeMonitoringModel", query: {modelData: item}});
+ this.$nextTick(() => {
+ this.$router.push({name: "realTimeMonitoringModel", query: {modelData: item}});
+ })
},
},
};
diff --git a/src/views/realTimeMonitoring/model.vue b/src/views/realTimeMonitoring/model.vue
index ffc4282..eeeff5d 100644
--- a/src/views/realTimeMonitoring/model.vue
+++ b/src/views/realTimeMonitoring/model.vue
@@ -1,6 +1,6 @@
-