:::

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

計數器

今天: 2652265226522652
昨天: 2345234523452345
總計: 7462845746284574628457462845746284574628457462845