Skip to content

Commit 16c6ce2

Browse files
GaoNeng-wWwkagol
authored andcommitted
fix: 修复检视意见
1 parent bd2639b commit 16c6ce2

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

packages/devui-vue/docs/.vitepress/demo/Demo.vue

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151

5252
<script>
5353
import { useRoute, useData } from 'vitepress';
54+
import { throttle } from 'lodash';
55+
import copy from 'clipboard-copy';
56+
// import clipboardCopy from
5457
import {
5558
ref,
5659
computed,
@@ -72,26 +75,6 @@ const clipboardCopy = async (text) => {
7275
}
7376
}
7477
}
75-
const throttle = (method, delay) => {
76-
let timer = null
77-
let begin = new Date()
78-
return function () {
79-
// eslint-disable-next-line @typescript-eslint/no-this-alias
80-
const context = this,
81-
args = arguments
82-
const current = new Date()
83-
const remaining = delay - (current - begin)
84-
clearTimeout(timer)
85-
if (remaining <= 0) {
86-
method.apply(context, args)
87-
begin = new Date()
88-
} else {
89-
timer = setTimeout(function () {
90-
method.apply(context, args)
91-
}, remaining)
92-
}
93-
}
94-
}
9578
export default {
9679
name: 'Demo',
9780
props: {
@@ -179,7 +162,8 @@ export default {
179162
}
180163
181164
const onCopy = () => {
182-
clipboardCopy(props.sourceCode)
165+
// clipboardCopy(props.sourceCode)
166+
copy(props.sourceCode)
183167
isShowTip.value = true
184168
setTimeout(() => {
185169
isShowTip.value = false

packages/devui-vue/docs/.vitepress/plugins/block-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const blockPlugin = (md: MarkdownIt) => {
4040
sourceCode="${md.utils.escapeHtml(content)}"
4141
lightCode="${encodeURIComponent(highlight(content, 'vue'))}"
4242
desc="${encodeURIComponent(localMd.render(description))}"
43-
:demo-list="demoList"
43+
:demoList="demoList"
4444
targetFilePath="${targetPath}"
4545
>
4646
${content ? `<!--vue-demo:${content}:vue-demo-->` : ''}

packages/devui-vue/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@vue/shared": "^3.2.33",
5252
"@vueuse/core": "8.9.4",
5353
"async-validator": "^4.0.7",
54+
"clipboard-copy": "^4.0.1",
5455
"dayjs": "^1.11.3",
5556
"devui-theme": "workspace:^0.0.1",
5657
"fs-extra": "^10.0.0",

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)