提交 c8dad44e 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(chooseLocation): 补充 ios uts 插件中调用示例及测试

上级 69f93989
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')
const isIos = platformInfo.startsWith('ios')
describe('dialog page', () => {
if (process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') {
......@@ -36,6 +37,16 @@ describe('dialog page', () => {
const lifecycleNum = await page.callMethod('getLifeCycleNum')
expect(lifecycleNum).toBe(originLifeCycleNum - 1)
})
if (isIos) {
it('call chooseLocation in uts plugin', async () => {
page = await program.reLaunch('/pages/API/choose-location/choose-location')
await page.waitFor('view');
await page.callMethod('chooseLocationByPlugin')
await page.waitFor(1000)
const lifecycleNum = await page.callMethod('getLifeCycleNum')
expect(lifecycleNum).toBe(originLifeCycleNum - 1)
})
}
afterAll(async () => {
await page.callMethod('setLifeCycleNum', originLifeCycleNum)
......
......@@ -21,6 +21,9 @@
<boolean-data :defaultValue="false" title="是否携带payload参数" @change="changePayloadBoolean"></boolean-data>
<button class="btn" type="primary" @tap="chooseLocation">选择位置</button>
<button class="btn" @tap="clear">清空</button>
<!-- #ifdef APP-IOS -->
<button class="btn" type="primary" @tap="chooseLocationByPlugin">通过 uts 插件调用 chooseLocation</button>
<!-- #endif -->
</view>
</view>
</view>
......@@ -117,6 +120,11 @@
changePayloadBoolean(checked : boolean) {
this.hoverPayload = checked
},
// #ifdef APP-IOS
chooseLocationByPlugin(){
uni.chooseLocationPlugin()
},
// #endif
// 自动化测试
test() {
const pages = getCurrentPages()
......
{
"id": "uni-chooseLocation-plugin",
"displayName": "uni-chooseLocation-plugin",
"version": "1.0.0",
"description": "uni-chooseLocation-plugin",
"keywords": [
"uni-chooseLocation-plugin"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.8"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [
"uni-chooseLocation"
],
"uni-ext-api": {
"uni": {
"chooseLocationPlugin": {
"name": "chooseLocationPlugin",
"app": {
"js": false,
"kotlin": false,
"swift": true,
"arkts": false
}
}
}
},
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-android": "u",
"app-ios": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
# uni-actionSheet
### 开发文档
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
[Hello UTS](https://gitcode.net/dcloud/hello-uts)
\ No newline at end of file
export const chooseLocationPlugin = () => {
uni.chooseLocation({
latitude: 39.951372,
longitude: 116.39747,
keyword: '公园',
success(res){
console.log('chooseLocation in plugin complete success', res);
},
fail(err){
console.log('chooseLocation in plugin complete fail', err);
},
complete(res){
console.log('chooseLocation in plugin complete res', res);
}
})
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册