45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
"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)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/111111000000/uniapp04/pages/vegetables/vegetables.vue"]]);
|
|
my.createPage(MiniProgramPage);
|