当前位置:网站首页>uniapp复制内容到剪贴板
uniapp复制内容到剪贴板
2022-06-29 22:28:00 【前端 贾公子】
1、介绍
vue-clipboard2是前端能够调用剪切板的一个插件。具体的描述官网上也有具体的说明,
npm地址
github地址
2、安装
npm install --save vue-clipboard23、main.js注册
// 复制文本插件
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)
4、使用
<view @click="copyText('复制内容')">复制</view>
// 复制
copyText(text) {
console.log(text);
// #ifdef H5
this.$copyText(text).then(
res => {
uni.showToast({
title: '复制成功'
})
}
)
// #endif
// #ifndef H5
uni.setClipboardData({
data: text,
success: () => {
uni.showToast({
title: '复制成功'
})
}
})
// #endif
},app版本号比较
compareVersion(version1, version2) {
console.log(version1, version2, '我被执行了现在版本是' + version1 + '最低版本是' + version2)
const v1 = version1.split('.');
const v2 = version2.split('.');
for (let i = 0; i < v1.length || i < v2.length; i++) {
let x = 0,
y = 0;
if (i < v1.length) {
x = parseInt(v1[i]);
}
if (i < v2.length) {
y = parseInt(v2[i])
}
if (x > y) return 1;
if (x < y) return -1;
}
return 0;
},边栏推荐
- Detailed description of gaussdb (DWS) complex and diverse resource load management methods
- Hidden worries behind the listing of shushulang: the performance has declined significantly, the market position is relatively backward, and the competitiveness is questionable
- [proteus simulation] digital tube display of stepping motor speed
- 每日刷题记录 (八)
- [php8+oracle11g+windows environment without tools] Intranet / no network /win10/php connecting to Oracle database instance
- 這個flink cdc可以用在做oracle到mysql的,增量同步嗎
- leetcode 416. Partition Equal Subset Sum 分割等和子集(中等)
- Mysql database: partition
- 工业细节都是钱和时间砸出来的
- Online text digit recognition list summation tool
猜你喜欢

2022年第一季度保险服务数字化跟踪分析

Problem solving metauniverse, multi communication scheme in online games

Ansible自动化运维

Underlying principles of file operations (file descriptors and buffers)

解题元宇宙,网络游戏中的多元通信方案

科大讯飞 AI 学习机暑期新品发布会 AI + 教育深度结合再创产品新高度
Talk about auto in MySQL in detail_ What is the function of increment
![leetcode:91. Decoding method [DFS + memorization]](/img/8d/9f61961fa9cfc6809a7800913e8761.png)
leetcode:91. Decoding method [DFS + memorization]

Optional类的高级使用

One click file sharing software jirafeau
随机推荐
模板函数与特化函数实现高效dynamicCast
Cloud native enthusiast weekly: cool collection of grafana monitoring panels
An in-depth analysis of the election mechanism in kubernetes
合宙AIR32F103CBT6开发板上手报告
Three development trends of enterprise application viewed from the third technological revolution
Does rapid software delivery really need to be at the cost of security?
One click file sharing software jirafeau
新手必须知道的 Kubernetes 架构
[php8+oracle11g+windows environment without tools] Intranet / no network /win10/php connecting to Oracle database instance
How ZABBIX 5.0 adds esxi6.7 to monitoring
Realizing deep learning framework from zero -- LSTM from theory to practice [theory]
动态规划学习(持续更新)
If I am in Zhuhai, where can I open an account? Is it safe to open an account online?
5-2Web应用程序漏洞扫描
联通入库|需要各地联通公司销售其产品的都需要先入总库
Processing of error b6267342 reported by AIX small machine in production environment
qt5.14.2连接ubuntu20.04的mysql数据库出错
Golang code specification sorting
短视频平台搭建,淡入淡出 支持左滑右滑轮播图
If you master these 28 charts, you will no longer be afraid to be asked about TCP knowledge during the interview