chore: improve demo analytics for copy

This commit is contained in:
Justineo
2023-09-14 10:49:37 +08:00
parent ccb951e11b
commit 21fae71b9e

View File

@ -68,6 +68,7 @@ watch(
}
);
const copied = ref(false);
const initializing = ref(true);
const optionCode = ref("");
const transformedCode = ref("");
@ -136,13 +137,22 @@ const importCode = computed(() => {
}
});
watch(importCode, () => {
copied.value = false;
});
// copy message
const messageOpen = ref(false);
let messageTimer;
function trackCopy(from) {
if (copied.value) {
// only track copy after modifications
return;
}
copied.value = true;
track("copy-code", { from });
console.log("copied");
}
function copy() {