赞
踩
- <view class="form_left">
- <text class="form_one">订单编号</text>
- <text class="form_two">{{ orderNumber }}</text>
- <text class="form_copy" @click="copyChange(orderNumber)">复制</text>
- </view>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app';
- import { ref } from 'vue';
- const orderNumber = ref('C2023020115CZ293829109819');
- // 复制订单编号
-
- const copyChange = (data) => {
- console.log('data', data);
- console.log('复制订单编号', 1111111);
- uni.setClipboardData({
- data: data,
- success: function (res) {
- console.log('success', res);
- uni.getClipboardData({
- success: function (res) {
- console.log('粘贴', res);
- }
- });
- uni.showToast({
- title: '复制成功',
- icon: 'none'
- });
- },
- fail: (error) => {
- console.log('失败', error);
- uni.showToast({
- title: '复制失败',
- icon: 'none'
- });
- }
- });
- };
-
- };
- </script>
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。