当前位置:网站首页>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;
},边栏推荐
- What are the software testing methods and technical knowledge points?
- Spark cluster installation
- MySQL lock common knowledge points & summary of interview questions
- 联通入库|需要各地联通公司销售其产品的都需要先入总库
- Ansible automatic operation and maintenance
- Can cdc2.2.1 listen to multiple PgSQL libraries at the same time?
- 新手必须知道的 Kubernetes 架构
- Digital tracking analysis of insurance services in the first quarter of 2022
- 模板函数与特化函数实现高效dynamicCast
- grpc的开发详解
猜你喜欢

Kubernetes architecture that novices must know

Detailed description of gaussdb (DWS) complex and diverse resource load management methods

Ansible自动化运维

With the rise of China's database, Alibaba cloud lifeifei: China's cloud database has taken the lead in various mainstream technological innovations abroad

Touch key and key control corresponding LED status reversal

Summer rainbow comes for dinner

合宙AIR32F103CBT6开发板上手报告

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

IFLYTEK AI learning machine summer new product launch AI + education depth combination to create a new height of products

服务器快速搭建AList集成网盘网站【宝塔面板一键部署AList】
随机推荐
Hidden worries behind the listing of shushulang: the performance has declined significantly, the market position is relatively backward, and the competitiveness is questionable
What if MySQL fails to store emoticons
Free PDF to word software sharing, these software must know!
LeetCode85+105+114+124
Low code, end-to-end, one hour to build IOT sample scenarios, and the sound network released lingfalcon Internet of things cloud platform
软件快速交付真的需要以安全为代价吗?
How to use filters in jfinal to monitor Druid for SQL execution?
Three development trends of enterprise application viewed from the third technological revolution
工业细节都是钱和时间砸出来的
Basic use of Nacos configuration center
Portable 4K audio and video conference terminal all-in-one machine with 8x digital zoom
With the rise of China's database, Alibaba cloud lifeifei: China's cloud database has taken the lead in various mainstream technological innovations abroad
Ansible自动化运维
Qt5.14.2 error connecting to the MySQL database of Ubuntu 20.04
关于深度学习的概念理解(笔记)
《天天数学》连载54:二月二十三日
STM32 basic knowledge points
The client can connect to remote MySQL
一键式文件共享软件Jirafeau
Laravel creates its own facade extension geoip to obtain country, region and city information according to IP