mounted() {
this.getElevatorList();
setInterval(this.getElevatorList, 15000);
}
在mounted()函數裏邊使用setInterval(), getElevatorList()這個方法在methods裏邊寫,在mounted鉤子函數裏邊調用就可以,剛開始先調用一遍,加載。然後使用setInterval(),第一個參數,調用方法的時候,不加括號,第二個參數是時間。
mounted() {
this.getElevatorList();
setInterval(this.getElevatorList, 15000);
}
在mounted()函數裏邊使用setInterval(), getElevatorList()這個方法在methods裏邊寫,在mounted鉤子函數裏邊調用就可以,剛開始先調用一遍,加載。然後使用setInterval(),第一個參數,調用方法的時候,不加括號,第二個參數是時間。