<template>
<view>
<button @click="copyText">复制文本</button>
</view>
</template>
<script>
export default {
methods: {
copyText() {
const text = '要复制的文本内容';
uni.setClipboardData({
data: text,
success() {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
}
}
};
</script>
uni-app:点击按钮复制文本内容(uni.setClipboardData)
最新推荐文章于 2024-03-17 07:00:00 发布