mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-18 06:34:42 +08:00
chore: track copy more precisely
This commit is contained in:
@ -136,8 +136,13 @@ const importCode = computed(() => {
|
|||||||
const messageOpen = ref(false);
|
const messageOpen = ref(false);
|
||||||
let messageTimer;
|
let messageTimer;
|
||||||
|
|
||||||
|
function trackCopy(from) {
|
||||||
|
va.track("copy-code", { from });
|
||||||
|
console.log("copied");
|
||||||
|
}
|
||||||
|
|
||||||
function copy() {
|
function copy() {
|
||||||
va.track("copy-code");
|
trackCopy("button");
|
||||||
clearTimeout(messageTimer);
|
clearTimeout(messageTimer);
|
||||||
|
|
||||||
navigator.clipboard.writeText(importCode.value);
|
navigator.clipboard.writeText(importCode.value);
|
||||||
@ -220,15 +225,16 @@ onBeforeUnmount(() => {
|
|||||||
:disabled="initializing"
|
:disabled="initializing"
|
||||||
autofocus
|
autofocus
|
||||||
></textarea>
|
></textarea>
|
||||||
<code-highlight
|
<div class="import-code" @copy="trackCopy('system')">
|
||||||
class="import-code"
|
<code-highlight
|
||||||
:language="codegenOptions.includeType ? 'typescript' : 'javascript'"
|
:language="codegenOptions.includeType ? 'typescript' : 'javascript'"
|
||||||
:code="importCode"
|
:code="importCode"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
class="copy"
|
class="copy"
|
||||||
@click="copy"
|
@click="copy"
|
||||||
:disabled="importCode.startsWith('/*')"
|
:disabled="importCode.startsWith('/*') || importCode.startsWith('//')"
|
||||||
>
|
>
|
||||||
Copy
|
Copy
|
||||||
</button>
|
</button>
|
||||||
@ -307,8 +313,8 @@ input[type="number"] {
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
tab-size: 4;
|
tab-size: 4;
|
||||||
|
|
||||||
textarea,
|
.option-code,
|
||||||
pre {
|
.import-code {
|
||||||
flex: 0 0 50%;
|
flex: 0 0 50%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
@ -317,18 +323,24 @@ input[type="number"] {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
.import-code {
|
||||||
padding: 0;
|
|
||||||
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
background: #fff;
|
|
||||||
box-shadow: none;
|
pre {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
.option-code {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
outline: none;
|
outline: none;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
@ -187,7 +187,6 @@ pre {
|
|||||||
padding: 0.8em;
|
padding: 0.8em;
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.125);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.125);
|
||||||
font-size: 0.8em;
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
pre,
|
pre,
|
||||||
|
Reference in New Issue
Block a user