<script> export default { data() { return { list: [] // 獲取的數據列表 } } created() { this.getData() } methods: { // 這是獲取數據的函數 getData() { ..... } // 這是一個定時器 timer() { return setTimeout(()=>{ this.getData() },5000) } }, watch: { list() { this.timer() } } destroyed() { clearTimeout(this.timer) } } </script>