当前位置:网站首页>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
边栏推荐
- Comment eolink facilite le télétravail
- MySQL error packet out of order
- 中富金石财富班29800效果如何?与专业投资者同行让投资更简单
- Is asemi ultrafast recovery diode interchangeable with Schottky diode
- Select receives both normal data and out of band data
- epoll 的 ET,LT工作模式———实例程序
- LeetCode165-比较版本号-双指针-字符串
- Realization of four data flow modes of grpc based on Multilingual Communication
- What is the main purpose of PCIe X1 slot?
- How does eolink help telecommuting
猜你喜欢
Interviewer: let's talk about the process of class loading and the mechanism of class loading (parental delegation mechanism)
MDS55-16-ASEMI整流模块MDS55-16
Is asemi ultrafast recovery diode interchangeable with Schottky diode
三、梯度下降求解最小θ
1-初识Go语言
LeetCode167-两数之和II-双指针-二分-数组-查找
Mds55-16-asemi rectifier module mds55-16
The art of automation
How to upload large files quickly?
剑指 Offer II 019. 最多删除一个字符得到回文(简单)
随机推荐
[jz46 translate numbers into strings]
Unity_ Code mode add binding button click event
Leetcode167 - sum of two numbers II - double pointer - bisection - array - Search
Fill in the next right node pointer II of each node [classical hierarchy traversal | regarded as linked list]
raised exception class EAccexxViolation with ‘Access violation at address 45EFD5 in module 出错
压缩映射定理
epoll 的EPOLLONESHOT 事件———实例程序
自动化的艺术
[proteus simulation] automatic range (range < 10V) switching digital voltmeter
Brute force of DVWA low -- > High
帧同步 实现
Async void caused the program to crash
Leetcode149 - maximum number of points on a line - Math - hash table
小红书 timestamp2 (2022/04/22)
I/O复用的高级应用:同时处理 TCP 和 UDP 服务
MDS55-16-ASEMI整流模块MDS55-16
拼接hql时,新增字段没有出现在构造方法中
【JZ46 把数字翻译成字符串】
剑指 Offer II 019. 最多删除一个字符得到回文(简单)
如何打开Win10启动文件夹?