parent
1c48d19c51
commit
5aa767e3d5
@ -0,0 +1,62 @@
|
||||
|
||||
<template>
|
||||
<div class="test">
|
||||
<Gauge :option="machineinfo" ref="vgauge"></Gauge>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Gauge from "@/components/echarts/Gauge.vue";
|
||||
import { MachineInfo, WorkData, WeekProcess } from "./chart-options";
|
||||
export default {
|
||||
components: {
|
||||
Gauge,
|
||||
// Bar,
|
||||
// Line,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
machineinfo: MachineInfo
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.$refs.vgauge);
|
||||
console.log("数据测试...");
|
||||
this.onLoading();
|
||||
window.addEventListener('beforeunload', this.clearTimer); // 监听页面刷新或关闭
|
||||
},
|
||||
methods: {
|
||||
getMachineInfo(){
|
||||
this.machineinfo = this.base.deepClone(MachineInfo);
|
||||
},
|
||||
onLoading() {
|
||||
this.timer = setInterval(() => {
|
||||
// this.machineinfo.series[0].data[0].value += 0.01;
|
||||
this.getMachineInfo();
|
||||
console.log(123456);
|
||||
}, 10000);
|
||||
},
|
||||
clearTimer() { //清除定时器
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.timer && this.clearTimer();
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener('beforeunload', this.clearTimer) // 卸载监听事件
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
// vue3 改写dv-loading样式
|
||||
.test {
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue