import { setInterval } from ‘timers’;
export default {
data(){
return {
lines:[{lineName:‘13号线’}],
stations: [
{stationName: ‘西直门’},
{stationName: ‘大钟寺’},
{stationName: ‘知春路’},
{stationName: ‘五道口’},
{stationName: ‘上地’},
{stationName: ‘西二旗’},
{stationName: ‘龙泽’}],
positions: [
{left: 1, bottom:20 ,name: ‘车01’},
{left: 1, bottom:20 , name: ‘车02’},
{left: 1, bottom:20 ,name: ‘车03’},
{left: 1, bottom:20 ,name: ‘车04’}]
}
},
methods: {
calcPosition() {
let arr = [ 0, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600];
// let arr1 = arr.reverse();
let count = 0;
setInterval(() => {
if (count > arr.length -1) return
this.positions[0].left = arr[count];
this.positions[1].left = arr[count + 1];
this.positions[2].left = arr[count +
vue根据站点A 与 站点B 之间的间距 实现小车(可能为多辆车)的动态移动_vue 实现a区域到b区域的移动动画
最新推荐文章于 2024-08-29 17:07:09 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)