提交 bfefcb95 编写于 作者: DCloud-yyl's avatar DCloud-yyl

新增web端通过url scheme打开hello uni-app x应用示例

上级 b80d6908
......@@ -1309,13 +1309,13 @@
"navigationBarTitleText": "日历"
}
},
// #endif
{
"path": "pages/template/schema/schema",
"style": {
"navigationBarTitleText": "打开schema示例"
}
},
// #endif
// #ifdef APP-ANDROID
{
"path": "pages/template/share/share",
......
......@@ -184,16 +184,16 @@
open: false,
pages: [] as Page[],
},
// #endif
{
id: 'schema',
url: 'schema',
name: '打开外部链接',
open: false,
pages: [] as Page[],
}
// #endif
},
// #ifdef APP-ANDROID
,{
{
id: 'share',
url: 'share',
name: '分享示例',
......
<template>
<view>
<!-- #ifdef APP -->
<button class="button" @click="openSchema('https://uniapp.dcloud.io/uni-app-x')">使用外部浏览器打开指定URL</button>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<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')">
......@@ -12,6 +14,13 @@
<button class="button" @click="openSchema('http://maps.apple.com/?q=数字天堂公司&sll=39.9631018208,116.3406135236&z=10&t=s')">打开 iOS 地图坐标</button>
<!-- apple协议:https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html -->
<!-- #endif -->
<!-- #ifdef WEB -->
<view class="tip">
<text>仅Android/iOS设备的浏览器中支持使用此功能,需先安装“Hello uni-app x”应用,如未安装请前往以下网页安装:</text>
<text class="link" @click="openSchema('https://hellouniappx.dcloud.net.cn/')">https://hellouniappx.dcloud.net.cn/</text>
</view>
<button class="button" @click="openSchema('hellouniappx://')">启动 Hello uni-app x 应用</button>
<!-- #endif -->
</view>
</template>
......@@ -23,4 +32,12 @@ import { openSchema } from '@/uni_modules/uts-openSchema'
.button {
margin: 15px;
}
.tip {
padding: 8px;
}
.link {
color: #7A7E83;
font-size: 14px;
line-height: 20px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册