This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
._dflex button {
margin: 10px 0;
background-color: red;
color: white;
}

View File

@@ -0,0 +1,36 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '剪切板',
path: 'packageAPI/pages/clipboard-data/clipboard-data'
};
},
data: {
value: 'edit and copy me',
pasted: ''
},
valueChanged(e) {
this.setData({
value: e.detail.value
});
},
copy() {
xhs.setClipboardData({
data: this.data.value,
success: res => {},
fail: res => {}
});
},
paste() {
xhs.getClipboardData({
success: res => {
this.setData({
pasted: res.data
});
},
fail: res => {}
});
}
}, __templateJs));

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "剪切板",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,19 @@
<view class="container">
<showbox title="剪切板操作">
<box>
<view>
<view class="_ui-space">
<view>
<view style="text-align: center;">{{pasted}}</view>
<view class="_ui-input">
<input type="text" name="key" value="{{value}}" bindinput="valueChanged"></input>
</view>
</view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="copy">复制</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="paste">粘贴</button>
</view>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,90 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: "",
page_data_1: false,
page_data_2: false,
page_data_3: false,
page_data_4: "",
page_data_5: false,
page_data_6: false,
page_data_7: false,
page_data_8: "",
},
page_fun_1(e) {
this.setData("page_data_0", e.detail.value);
},
page_fun_0() {
this.setData({
page_data_1: false,
page_data_2: false,
page_data_3: false,
});
xhs.setClipboardData({
success: (res) => {
console.log("success", res);
this.setData({
page_data_1: true,
page_data_4: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_2: true,
page_data_4: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_3: true,
});
},
data: this.data.page_data_0,
});
},
page_fun_2() {
this.setData({
page_data_5: false,
page_data_6: false,
page_data_7: false,
});
xhs.getClipboardData({
success: (res) => {
console.log("success", res);
this.setData({
page_data_5: true,
page_data_8: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_6: true,
page_data_8: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_7: true,
});
},
});
},
};

View File

@@ -0,0 +1,49 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="setClipboardData演示">
<box>
<api-status
success="{{page_data_1}}"
complete="{{page_data_3}}"
fail="{{page_data_2}}"
text="{{page_data_4}}"
>
</api-status>
<view class="_ui-space _mt8">
<view class="_ui-input">
<input placeholder="data" type="text" bindinput="page_fun_1" />
</view>
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
<showbox title="getClipboardData演示">
<box>
<api-status
success="{{page_data_5}}"
complete="{{page_data_7}}"
fail="{{page_data_6}}"
text="{{page_data_8}}"
>
</api-status>
<view class="_ui-space _mt8">
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_2"
>
触发
</button>
</view>
</box>
</showbox>
</view>