当前位置:网站首页>JS - implémenter la fonction de copie par clic
JS - implémenter la fonction de copie par clic
2022-04-23 14:55:00 【Casey Wei】
Sélectionnez copier
<template>
<el-button type="primary" plain @click="onCopy">Copier</el-button>
</template>
<script>
export default {
methods:{
onCopy(){
document.execCommand("Copy"); // Exécuter la commande de copie du navigateur
this.$message({
message: 'Copie réussie',
type: 'success'
});
}
}
}
</script>
Cliquez pour copier
<template>
<el-button type="primary" plain @click="onCopy">Copier</el-button>
</template>
<script>
export default {
methods:{
onCopy(){
const url = 'Je suis le contenu à copier'
let oInput = document.createElement('input')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // Sélectionner des objets;
document.execCommand('Copy') // Exécuter la commande de copie du navigateur
this.$message({
message: 'Copie réussie',
type: 'success'
})
oInput.remove()
}
}
</script>
版权声明
本文为[Casey Wei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231454092339.html
边栏推荐
- Programming philosophy - automatic loading, dependency injection and control inversion
- Little red book timestamp2 (2022 / 04 / 22)
- 分享 20 个不容错过的 ES6 的技巧
- When splicing HQL, the new field does not appear in the construction method
- OPPO数据湖统一存储技术实践
- Using MATLAB programming to realize the steepest descent method to solve unconstrained optimization problems
- select 同时接收普通数据 和 带外数据
- capacitance
- Pnpm installation and use
- eolink 如何助力远程办公
猜你喜欢

GIS数据处理-cesium中模型位置设置

Leetcode165 compare version number double pointer string

Set up an AI team in the game world and start the super parametric multi-agent "chaos fight"

Provided by Chengdu control panel design_ It's detailed_ Introduction to the definition, compilation and quotation of single chip microcomputer program header file

【NLP】HMM隐马尔可夫+维特比分词

1-初识Go语言

你還不知道責任鏈模式的使用場景嗎?

The art of automation

How does eolink help telecommuting

线程同步、生命周期
随机推荐
Unity_ Code mode add binding button click event
Arduino for esp8266串口功能简介
Borui data and F5 jointly build the full data chain DNA of financial technology from code to user
Contraction mapping theorem
Flink DataStream 类型系统 TypeInformation
Chapter 7 of JVM series -- bytecode execution engine
UML学习_day2
LeetCode167-两数之和II-双指针-二分-数组-查找
Swift:Entry of program、Swift调用OC、@_silgen_name 、 OC 调用Swift、dynamic、String、Substring
2-GO variable operation
Explain TCP's three handshakes in detail
[proteus simulation] automatic range (range < 10V) switching digital voltmeter
Go basic reflection
Share 20 tips for ES6 that should not be missed
nuxt项目:全局获取process.env信息
When splicing HQL, the new field does not appear in the construction method
编程哲学——自动加载、依赖注入与控制反转
【STC8G2K64S4】比较器介绍以及比较器掉电检测示例程序
Async void caused the program to crash
封面和标题中的关键词怎么写?做自媒体为什么视频没有播放量