Commit 324501af authored by Jenny's avatar Jenny

feat: 实时时间

parent 280dfa8c
<template>
<view>
<div class="timer">
<NormalTitle :elementInfo="elementInfo"></NormalTitle>
<div :style="{
'font-size':`${elementInfo.option.time.textStyle.fontSize}px`,
'color': elementInfo.option.time.textStyle.color,
'font-weight': elementInfo.option.time.textStyle.fontWeight,
'text-align': elementInfo.option.time.left,
}">
{{ realTime }}
</div>
</div>
<view class="timer">
<NormalTitle :elementInfo="elementInfo"></NormalTitle>
<view :style="{
'font-size':`${elementInfo.option.time.textStyle.fontSize}px`,
'color': elementInfo.option.time.textStyle.color,
'font-weight': elementInfo.option.time.textStyle.fontWeight,
'text-align': elementInfo.option.time.left,
}">
{{ realTime }}
</view>
</view>
</template>
......@@ -26,17 +24,21 @@
timer: null
};
},
onReady() {
this.getRealTime()
},
onUnLoad() {
clearInterval(this.timer)
this.timer = null
},
methods: {
initChart() {
getRealTime() {
this.timer = setInterval(() => {
const timestamp = new Date().getTime()
this.realTime = this.$u.timeFormat(timestamp, this.getDateFormat())
}, 1000)
},
initChart() {},
// 大屏报表时间格式和uniapp的不一致,需要转换
getDateFormat() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment