```调整fetchData方法的定时器间隔为2秒

在`index.vue`的`created`钩子中,更新了定时器的间隔时间,从之前的10秒调整为2秒,以提高数据获取的频率。
```
master
wxy 2024-09-29 10:14:36 +08:00
parent 3ba81754fc
commit 0932ed3cd2
1 changed files with 1 additions and 35 deletions

View File

@ -76,7 +76,7 @@ export default {
}, },
created() { created() {
// fetchData // fetchData
this.intervalId = setInterval(this.fetchData, 1000); // 1000010 this.intervalId = setInterval(this.fetchData, 2000); // 1000010
}, },
methods: { methods: {
async fetchData() { async fetchData() {
@ -128,40 +128,6 @@ export default {
} }
}, },
}, },
// methods: {
// fetchData() {
// getDataByRedis(this.carVin).then(res=>{
// this.data = res.data
// })
// },
// initMap() {
// this.map = new AMap.Map('map', {
// center: [116.397428, 39.90923], //
// zoom: 13, //
// });
//
// // 线
// this.polyline = new AMap.Polyline({
// map: this.map,
// path: [], //
// strokeColor: "#FF0000", // 线
// strokeWeight: 5, // 线
// });
//
// //
// setInterval(this.updateTrajectory, 1100);
// },
// updateTrajectory() {
// //
// const newPoint = [this.data.longitude, this.data.latitude];
// // 线
// const path = this.polyline.getPath();
// path.push(newPoint);
// this.polyline.setPath(path);
// //
// this.map.setCenter(newPoint);
// },
// },
mounted() { mounted() {
this.initMap(); this.initMap();
}, },