当前位置:网站首页>JS -- realize click Copy function
JS -- realize click Copy function
2022-04-23 14:55:00 【CaseyWei】
Select the copy
<template>
<el-button type="primary" plain @click="onCopy"> Copy </el-button>
</template>
<script>
export default {
methods:{
onCopy(){
document.execCommand("Copy"); // Execute browser copy command
this.$message({
message: ' Replication success ',
type: 'success'
});
}
}
}
</script>
Click replication
<template>
<el-button type="primary" plain @click="onCopy"> Copy </el-button>
</template>
<script>
export default {
methods:{
onCopy(){
const url = ' I am the content to be copied '
let oInput = document.createElement('input')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // Select object ;
document.execCommand('Copy') // Execute browser copy command
this.$message({
message: ' Replication success ',
type: 'success'
})
oInput.remove()
}
}
</script>
版权声明
本文为[CaseyWei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231454092339.html
边栏推荐
- OC to swift conditional compilation, marking, macro, log, version detection, expiration prompt
- How does eolink help telecommuting
- eolink 如何助力远程办公
- Mds55-16-asemi rectifier module mds55-16
- 分享 20 个不容错过的 ES6 的技巧
- Leetcode153 - find the minimum value in the rotation sort array - array - binary search
- Bingbing learning notes: take you step by step to realize the sequence table
- Want to be an architect? Tamping the foundation is the most important
- 压缩映射定理
- Swift protocol Association object resource name management multithreading GCD delay once
猜你喜欢

UML项目实例——抖音的UML图描述

Explanation and example application of the principle of logistic regression in machine learning

免费在upic中设置OneDrive或Google Drive作为图床
![[NLP] HMM hidden Markov + Viterbi word segmentation](/img/9a/b39a166320c2f2001f10913f789c90.png)
[NLP] HMM hidden Markov + Viterbi word segmentation

Want to be an architect? Tamping the foundation is the most important

do(Local scope)、初始化器、内存冲突、Swift指针、inout、unsafepointer、unsafeBitCast、successor、

利用 MATLAB 编程实现最速下降法求解无约束最优化问题

OC to swift conditional compilation, marking, macro, log, version detection, expiration prompt

Introduction to Arduino for esp8266 serial port function

1n5408-asemi rectifier diode
随机推荐
帧同步 实现
[untitled]
Vscode Chinese plug-in doesn't work. Problem solving
利用 MATLAB 编程实现最速下降法求解无约束最优化问题
Select receives both normal data and out of band data
eolink 如何助力遠程辦公
SQL中HAVING和WHERE的区别
Pnpm installation and use
牛客网数据库SQL实战详细剖析(26-30)
拼接hql时,新增字段没有出现在构造方法中
Contraction mapping theorem
Bingbing learning notes: take you step by step to realize the sequence table
博睿数据携手F5共同构建金融科技从代码到用户的全数据链DNA
UML学习_day2
How does eolink help telecommuting
do(Local scope)、初始化器、内存冲突、Swift指针、inout、unsafepointer、unsafeBitCast、successor、
详解TCP的三次握手
OPPO数据湖统一存储技术实践
Alexnet model
Role of asemi rectifier module mdq100-16 in intelligent switching power supply