Skip to content

Commit 21fae71

Browse files
committed
chore: improve demo analytics for copy
1 parent ccb951e commit 21fae71

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/demo/CodeGen.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ watch(
6868
}
6969
);
7070
71+
const copied = ref(false);
7172
const initializing = ref(true);
7273
const optionCode = ref("");
7374
const transformedCode = ref("");
@@ -136,13 +137,22 @@ const importCode = computed(() => {
136137
}
137138
});
138139
140+
watch(importCode, () => {
141+
copied.value = false;
142+
});
143+
139144
// copy message
140145
const messageOpen = ref(false);
141146
let messageTimer;
142147
143148
function trackCopy(from) {
149+
if (copied.value) {
150+
// only track copy after modifications
151+
return;
152+
}
153+
154+
copied.value = true;
144155
track("copy-code", { from });
145-
console.log("copied");
146156
}
147157
148158
function copy() {

0 commit comments

Comments
 (0)