:::

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.  

:::

書籍目錄

展開 | 闔起

快速登入


http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1751%26tbsn%3D33

計數器

今天: 845845845
昨天: 3068306830683068
總計: 8077350807735080773508077350807735080773508077350