提交 b85bd443 authored 作者: wangjiahao's avatar wangjiahao

feat: 增加默认刷新时间

上级 a205bf46
......@@ -20,6 +20,7 @@
:style="getComponentStyleDefault(config.style)"
:prop-value="config.propValue"
:element="config"
:search-count="searchCount"
/>
</div>
</template>
......@@ -42,6 +43,11 @@ export default {
type: Object,
require: false,
default: null
},
searchCount: {
type: Number,
required: false,
default: 0
}
},
computed: {
......
......@@ -7,6 +7,7 @@
v-for="(item, index) in componentDataInfo"
:key="index"
:config="item"
:search-count="searchCount"
/>
</div>
</template>
......@@ -57,7 +58,8 @@ export default {
timer: null,
componentDataShow: [],
mainWidth: '100%',
mainHeight: '100%'
mainHeight: '100%',
searchCount: -1
}
},
computed: {
......@@ -108,10 +110,17 @@ export default {
_this.restore()
})
})
// 数据刷新计时器
let refreshTime = 60000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
refreshTime = this.canvasStyleData.refreshTime * 1000
}
this.timer = setInterval(() => {
this.searchCount++
}, refreshTime)
},
created() {
// 先清除查询条件
// this.$store.dispatch('conditions/clear')
beforeDestroy() {
clearInterval(this.timer)
},
methods: {
changeStyleWithScale,
......
......@@ -54,6 +54,11 @@ export default {
default: function() {
return {}
}
},
searchCount: {
type: Number,
required: false,
default: 0
}
},
data() {
......@@ -123,6 +128,12 @@ export default {
}
},
deep: true
},
// 监听外部计时器变化
searchCount: function(val1) {
if (val1 > 0) {
this.getData(this.element.propValue.viewId)
}
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论