|
@@ -51,15 +51,12 @@
|
|
|
methods: {},
|
|
|
ready: function () {
|
|
|
let _this = this;
|
|
|
- let socketInterval = setInterval(() => {
|
|
|
- if (!!_this.$parent.$parent.socket) {
|
|
|
- _this.socket = _this.$parent.$parent.socket;
|
|
|
- _this.socket.emit('reports.index', res => {
|
|
|
- _this.reports = res.data;
|
|
|
- });
|
|
|
- clearInterval(socketInterval);
|
|
|
- }
|
|
|
- }, 100);
|
|
|
+ io.getSocket((socket) => {
|
|
|
+ _this.socket = socket;
|
|
|
+ _this.socket.emit('reports.index', res => {
|
|
|
+ _this.reports = res.data;
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
</script>
|