上传代码
This commit is contained in:
43
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.js
vendored
Normal file
43
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.js
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
__name: "vegetables",
|
||||
setup(__props) {
|
||||
const textToCopy = common_vendor.ref("这是要复制的文本");
|
||||
const copyText = async () => {
|
||||
try {
|
||||
await common_vendor.index.setClipboardData({
|
||||
data: textToCopy.value,
|
||||
success: () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "复制成功",
|
||||
icon: "success",
|
||||
duration: 2e3
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
common_vendor.index.showToast({
|
||||
title: "复制失败",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("复制失败:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "复制失败",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.t(textToCopy.value),
|
||||
b: common_vendor.o(copyText)
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
wx.createPage(_sfc_main);
|
6
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.json
vendored
Normal file
6
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "各种蔬菜",
|
||||
"navigationBarBackgroundColor": "#4095e5",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {}
|
||||
}
|
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.wxml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.wxml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<view><view class="content"><view class="text-to-copy" id="copy-text">{{a}}</view><button bindtap="{{b}}">复制文本</button></view></view>
|
11
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.wxss
vendored
Normal file
11
uniapp04/unpackage/dist/dev/mp-weixin/pages/vegetables/vegetables.wxss
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.text-to-copy {
|
||||
font-size: 16px;
|
||||
margin-bottom: 10px;
|
||||
}
|
Reference in New Issue
Block a user