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,33 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: 'canIUse',
path: 'package/API/pages/caniuse/caniuse'
};
},
data: {
value: '',
content: ''
},
onLoad() {
setTimeout(() => {
this.removeSkeleton();
}, 500);
},
bindinput(e) {
this.setData({
value: e.detail.value
});
},
click() {
this.setData({
content: '初始化'
});
const ret = xhs.canIUse(this.data.value);
this.setData({
content: ret
});
}
}, __templateJs));

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "检测api能力",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,15 @@
<view class="container">
<!-- canIUse -->
<showbox title="检验api是否可用">
<box>
<view>
<text>返回值:{{content}}</text>
<view class="_ui-input _my8">
<input placeholder="输入api调用" type="text" bindinput="bindinput"></input>
</view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="click">检索</button>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,51 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: "",
page_data_1: false,
page_data_2: false,
page_data_3: false,
page_data_4: "",
},
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,
});
let res;
try {
res = xhs.canIUse(this.data.page_data_0) ?? "无返回值";
} catch (err) {
console.log("fail", res);
this.setData({
page_data_2: true,
page_data_4: JSON.stringify(res),
});
return;
}
console.log("success", res);
this.setData({
page_data_1: true,
page_data_4: JSON.stringify(res),
});
console.log("complete", res);
this.setData({
page_data_3: true,
});
},
};

View File

@@ -0,0 +1,32 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="canIUse演示">
<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="canIUseString"
type="text"
bindinput="page_fun_1"
/>
</view>
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
</view>