当前位置:网站首页>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
边栏推荐
- 小红书 timestamp2 (2022/04/22)
- 免费在upic中设置OneDrive或Google Drive作为图床
- [proteus simulation] automatic range (range < 10V) switching digital voltmeter
- PCIe X1 插槽的主要用途是什么?
- Redis master-slave synchronization
- 封面和标题中的关键词怎么写?做自媒体为什么视频没有播放量
- OC to swift conditional compilation, marking, macro, log, version detection, expiration prompt
- What is the main purpose of PCIe X1 slot?
- go基础 反射
- 剑指 Offer II 019. 最多删除一个字符得到回文(简单)
猜你喜欢
Do (local scope), initializer, memory conflict, swift pointer, inout, unsafepointer, unsafebitcast, success
[detailed explanation of factory mode] factory method mode
免费在upic中设置OneDrive或Google Drive作为图床
capacitance
Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?
Thread synchronization, life cycle
Want to be an architect? Tamping the foundation is the most important
LeetCode153-寻找旋转排序数组中的最小值-数组-二分查找
Brute force of DVWA low -- > High
SVN详细使用教程
随机推荐
利用 MATLAB 编程实现最速下降法求解无约束最优化问题
Leetcode153 - find the minimum value in the rotation sort array - array - binary search
如何打开Win10启动文件夹?
Programming philosophy - automatic loading, dependency injection and control inversion
What is the main purpose of PCIe X1 slot?
编程哲学——自动加载、依赖注入与控制反转
Async void caused the program to crash
Go basic reflection
MySQL报错packet out of order
详解TCP的三次握手
Alexnet model
Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?
SQL中HAVING和WHERE的区别
3、 Gradient descent solution θ
Practice of unified storage technology of oppo data Lake
MDS55-16-ASEMI整流模块MDS55-16
Unity_ Code mode add binding button click event
OPPO数据湖统一存储技术实践
Resolve the conflict between computed attribute and input blur event
[jz46 translate numbers into strings]