File tree Expand file tree Collapse file tree 4 files changed +13
-22
lines changed Expand file tree Collapse file tree 4 files changed +13
-22
lines changed Original file line number Diff line number Diff line change 5151
5252<script >
5353import { useRoute , useData } from ' vitepress' ;
54+ import { throttle } from ' lodash' ;
55+ import copy from ' clipboard-copy' ;
56+ // import clipboardCopy from
5457import {
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- }
9578export 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
Original file line number Diff line number Diff 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-->` : '' }
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments