:::

1-3 setTimeout 倒數計時

  1. 要使用 setTimeout(),必須在卸載時去 clearTimeout()才行
    <script>
    export default {
      setup() {
        let timer = null;
    
        onMounted(() => {
          timer = setTimeout(() => {
            router.go(-1);
          }, 3000);
        });
    
        onUnmounted(() => {
          clearTimeout(timer);
        });
      },
    };
    </script>

     

  2.  

:::

書籍目錄

展開 | 闔起

https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D33%26tbdsn%3D1751

計數器

今天: 2571257125712571
昨天: 3755375537553755
總計: 4458410445841044584104458410445841044584104458410