uniapp click to copy text

<view class="content" @tap="copy(item)"></view>
			copy: function(item) {
				uni.showModal({
					title: '复制链接',
					content: item.url,
					confirmText: '复制',
					success: function(res) {
						if (res.confirm) {
							uni.setClipboardData({
								data: item.url,
								success: () => { //复制成功的回调函数
									uni.showToast({ //提示
										title: '复制成功'
									})
								}
							});
							console.log('用户点击确定');
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},

After obtaining the josn data, pass in the parameters and click to copy the contents 

Guess you like

Origin blog.csdn.net/weixin_43101671/article/details/108533077