利用插件實現複製到剪切板的實現功能vue
npm install --save vue-clipboard2
複製代碼
import VueClipboard from 'vue-clipboard2';
Vue.use(VueClipboard)
複製代碼
<div class="home-phone-copy">
<span>邀請</span>
<span class="home-phone-copy-span">
<b></b>
<button type="button" class="home-phone-butt" v-clipboard:copyhttplist="httplist" v-clipboard:success="onCopy">複製</button>
</span>
</div>
複製代碼
<script>
import IconNav from "../common/IconNav";
export default {
data() {
return {
message: '',
httplist: ‘’,
};
},
methods: {
onCopy(e) {
this.$notify({
message: "複製成功",
type: "success"
});
},
copymessage: function (e) {
},
copyhttplist: function (e) {
},
}
};
</script>
複製代碼