当前位置:网站首页>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
边栏推荐
- What is the effect of Zhongfu Jinshi wealth class 29800? Walk with professional investors to make investment easier
- async void 导致程序崩溃
- Fill in the next right node pointer II of each node [classical hierarchy traversal | regarded as linked list]
- Realization of four data flow modes of grpc based on Multilingual Communication
- 2-Go变量操作
- Explain TCP's three handshakes in detail
- LeetCode165-比较版本号-双指针-字符串
- 分布式事务Seata介绍
- 【无标题】
- One of the advanced applications of I / O reuse: non blocking connect -- implemented using select (or poll)
猜你喜欢
Progress in the treatment of depression
Chapter 7 of JVM series -- bytecode execution engine
What is the main purpose of PCIe X1 slot?
【NLP】HMM隐马尔可夫+维特比分词
Interviewer: let's talk about the process of class loading and the mechanism of class loading (parental delegation mechanism)
UML学习_day2
Leetcode151 - invert words in string - String - simulation
Detailed comparison between asemi three-phase rectifier bridge and single-phase rectifier bridge
qt之.pro文件详解
【无标题】
随机推荐
【NLP】HMM隐马尔可夫+维特比分词
Explanation and example application of the principle of logistic regression in machine learning
Progress in the treatment of depression
【无标题】
thinkphp5+数据大屏展示效果
Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?
do(Local scope)、初始化器、内存冲突、Swift指针、inout、unsafepointer、unsafeBitCast、successor、
Epolloneshot event of epoll -- instance program
epoll 的EPOLLONESHOT 事件———实例程序
编程哲学——自动加载、依赖注入与控制反转
Async keyword
nuxt项目:全局获取process.env信息
MySQL报错packet out of order
线程同步、生命周期
UML项目实例——抖音的UML图描述
SQL中HAVING和WHERE的区别
Alexnet model
Little red book timestamp2 (2022 / 04 / 22)
Leetcode149 - maximum number of points on a line - Math - hash table
Model location setting in GIS data processing -cesium