当前位置:网站首页>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
边栏推荐
猜你喜欢

【JZ46 把数字翻译成字符串】

eolink 如何助力遠程辦公

PCIe X1 插槽的主要用途是什么?

Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?

Interviewer: let's talk about the process of class loading and the mechanism of class loading (parental delegation mechanism)

LeetCode 练习——396. 旋转函数

Chapter 7 of JVM series -- bytecode execution engine

Swift - Literal,字面量协议,基本数据类型、dictionary/array之间的转换

面试官:说一下类加载的过程以及类加载的机制(双亲委派机制)

三、梯度下降求解最小θ
随机推荐
One of the advanced applications of I / O reuse: non blocking connect -- implemented using select (or poll)
LeetCode149-直线上最多的点数-数学-哈希表
Comment eolink facilite le télétravail
【STC8G2K64S4】比较器介绍以及比较器掉电检测示例程序
利用 MATLAB 编程实现最速下降法求解无约束最优化问题
Detailed analysis of SQL combat of Niuke database (26-30)
The difference between having and where in SQL
Leetcode167 - sum of two numbers II - double pointer - bisection - array - Search
【工厂模式详解】工厂方法模式
Flink DataStream 类型系统 TypeInformation
Share 3 tools, edit 5 works at home and earn more than 400
GIS数据处理-cesium中模型位置设置
抑郁症治疗的进展
1 - first knowledge of go language
Leetcode165 compare version number double pointer string
[stc8g2k64s4] introduction of comparator and sample program of comparator power down detection
脏读、不可重复读和幻读介绍
SQL中HAVING和WHERE的区别
8.3 language model and data set
【无标题】