This commit is contained in:
2023-06-08 21:09:28 +08:00
parent d778ceab61
commit f8947d332a
158 changed files with 17210 additions and 259 deletions

View File

@@ -0,0 +1,27 @@
import useClipboard from "vue-clipboard3"
import { Message } from "@arco-design/web-vue"
const copy = (el, binding) => {
const { value } = binding
el.addEventListener("click", async () => {
if (value && value !== "") {
try {
await useClipboard().toClipboard(value)
Message.success("已成功复制到剪切板")
} catch (e) {
Message.error("复制失败")
}
} else {
throw new Error(`need for copy content! Like v-copy="Hello World"`)
}
})
}
export default {
mounted(el, binding) {
copy(el, binding)
},
updated(el, binding) {
copy(el, binding)
}
}