提交 b16b00ca 编写于 作者: W wanganxp

打开schema的示例

上级 ad080cde
...@@ -1047,6 +1047,13 @@ ...@@ -1047,6 +1047,13 @@
"navigationBarTitleText" : "install-apk", "navigationBarTitleText" : "install-apk",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path" : "pages/template/schema/schema",
"style" :
{
"navigationBarTitleText" : "打开schema示例"
}
} }
], ],
......
<template>
<view>
<button class="button" @click="openSchema('https://uniapp.dcloud.io/uni-app-x')">使用外部浏览器打开指定URL</button>
<button class="button" @click="openSchema('market://details?id=com.tencent.mm')">使用应用商店打开指定App</button>
<button class="button" @click="openSchema('androidamap://viewMap?sourceApplication=Hello%20uni-app&poiname=DCloud&lat=39.9631018208&lon=116.3406135236&dev=0')">打开地图坐标</button>
</view>
</template>
<script>
import Intent from 'android.content.Intent';
import Uri from 'android.net.Uri';
export default {
data() {
return {
}
},
methods: {
openSchema(url:string) {
const context = UTSAndroid.getUniActivity()!;
const uri = Uri.parse(url)
const intent = new Intent(Intent.ACTION_VIEW, uri)
intent.setData(uri);
context.startActivity(intent);
}
}
}
</script>
<style>
.button {
margin: 30rpx;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册