mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
15 lines
514 B
JavaScript
15 lines
514 B
JavaScript
|
|
Vue.component("copy-to-clipboard", {
|
||
|
|
props: ["v-target"],
|
||
|
|
created: function () {
|
||
|
|
let jsFile = document.createElement("script")
|
||
|
|
jsFile.setAttribute("src", "/js/clipboard.min.js")
|
||
|
|
document.head.appendChild(jsFile)
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
copy: function () {
|
||
|
|
new ClipboardJS('[data-clipboard-target]');
|
||
|
|
teaweb.success("已复制到剪切板")
|
||
|
|
}
|
||
|
|
},
|
||
|
|
template: `<a href="" title="拷贝到剪切板" :data-clipboard-target="'#' + vTarget" @click.prevent="copy"><i class="ui icon copy small"></i></em></a>`
|
||
|
|
})
|