uniapp 长按复制文字
·
<template>
<view class="container" @longpress="onLongPress">{{text}}</view>
</template>
<script>
export default {
data() {
return {
text: '这是要被复制的文本'
}
},
methods: {
onLongPress() {
uni.setClipboardData({
data: this.text,
success: function () {
uni.showToast({
title: '复制成功'
})
}
})
}
}
}
</script>
更多推荐
所有评论(0)