1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- var vm = new Vue({
- el: '#app',
- data: {
- timer: null,
- lineDatas: []
- },
- mounted() {
- this.getLineData()
- },
- methods: {
- getLineData() {
- let _this = this
- axios
- .get('/Line/GetKeyInInfos')
- .then(function (response) {
- _this.lineDatas = response.data
- console.log(_this.lineDatas)
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- setTimer() {
- if (this.timer == null) {
- this.timer = setInterval(() => {
- this.getLineData()
- }, 60000)
- }
- },
- clearTimer() {
- clearInterval(this.timer)
- this.timer = null
- }
- },
- filters: {
- dataTimeFormat: function (value) {
- return value.substr(11, 5)
- }
- },
- created: function () {
- this.clearTimer()
- this.setTimer()
- },
- destroyed: function () {
- this.clearTimer()
- }
- })
|