:::

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%3Ftbdsn%3D1751%26tbsn%3D33

計數器

今天: 4857485748574857
昨天: 2489248924892489
總計: 8026839802683980268398026839802683980268398026839