console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.common.dev.js"></script>
<script src="https://unpkg.com/element-ui@2.15.2/lib/index.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-clipboard2/0.3.1/vue-clipboard.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.2/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<el-form >
<el-form-item label="内容" >
<el-input type="textarea" v-model="content" rows="5"/>
</el-form-item>
</el-form>
</div>
<script>
Vue.use(VueClipboard);
notify = ELEMENT.Notification
const vue = new Vue({
el: "#app",
data: {
content: ""
},
watch: {
content: function (val) {
this.content = val.split(/\s+/).join("")
this.$copyText(this.content).then(function (e) {
this.content = ""
}, function (e) {
notify({
message: '链接复制失败,请手动复制',
type: 'success'
})
})
},
}
})
vue.prototype.$notify = ELEMENT.Notification
</script>
</body>
</html>
</body>
</html>