icssoa 4 hónapja
szülő
commit
5d6c14ed54
2 módosított fájl, 13 hozzáadás és 4 törlés
  1. 1 1
      package.json
  2. 12 3
      pages/demo/status/countdown.uvue

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 	"name": "cool-unix",
-	"version": "8.0.31",
+	"version": "8.0.32",
 	"license": "MIT",
 	"scripts": {
 		"build-ui": "node ./uni_modules/cool-ui/scripts/generate-types.js",

+ 12 - 3
pages/demo/status/countdown.uvue

@@ -60,7 +60,7 @@
 <script lang="ts" setup>
 import { t } from "@/locale";
 import DemoItem from "../components/item.uvue";
-import { onMounted, ref } from "vue";
+import { onMounted, onUnmounted, ref } from "vue";
 import { dayUts, isDark, parseClass } from "@/cool";
 import { useUi } from "@/uni_modules/cool-ui";
 
@@ -76,9 +76,18 @@ function onDone() {
 
 const countdownRef = ref<ClCountdownComponentPublicInstance | null>(null);
 
+let timer: number = 0;
+
 onMounted(() => {
-	setTimeout(() => {
-		countdownRef.value!.next();
+	// @ts-ignore
+	timer = setTimeout(() => {
+		if (countdownRef.value != null) {
+			countdownRef.value.next();
+		}
 	}, 3000);
 });
+
+onUnmounted(() => {
+	clearTimeout(timer);
+});
 </script>