schema.uvue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view>
  3. <!-- #ifdef APP -->
  4. <button class="button" @click="openSchema('https://uniapp.dcloud.io/uni-app-x')">使用外部浏览器打开指定URL</button>
  5. <!-- #endif -->
  6. <!-- #ifdef APP-ANDROID -->
  7. <button class="button" @click="openSchema('market://details?id=com.tencent.mm')">使用应用商店打开指定App</button>
  8. <button class="button" @click="openSchema('androidamap://viewMap?sourceApplication=Hello%20uni-app&poiname=DCloud&lat=39.9631018208&lon=116.3406135236&dev=0')">
  9. 打开地图坐标
  10. </button>
  11. <!-- #endif -->
  12. <!-- #ifdef APP-IOS -->
  13. <button class="button" @click="openSchema('itms-apps://search.itunes.apple.com//WebObjects//MZSearch.woa/wa/search?media=software&lterm=')">打开 AppStore 到搜索页</button>
  14. <button class="button" @click="openSchema('http://maps.apple.com/?q=数字天堂公司&sll=39.9631018208,116.3406135236&z=10&t=s')">打开 iOS 地图坐标</button>
  15. <!-- apple协议:https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html -->
  16. <!-- #endif -->
  17. <!-- #ifdef WEB -->
  18. <view class="tip">
  19. <text>仅Android/iOS设备的浏览器中支持使用此功能,需先安装“Hello uni-app x”应用,如未安装请前往以下网页安装:</text>
  20. <text class="link" @click="openSchema('https://hellouniappx.dcloud.net.cn/')">https://hellouniappx.dcloud.net.cn/</text>
  21. </view>
  22. <button class="button" @click="openSchema('hellouniappx://')">启动 Hello uni-app x 应用</button>
  23. <!-- #endif -->
  24. <!-- #ifdef APP-HARMONY -->
  25. <button class="button" @click="openSchema('https://appgallery.huawei.com/app/detail?id=io.dcloud.hellouniapp.h')">使用应用商店打开指定App</button>
  26. <button class="button" @click="openSchema('amapuri://route/plan?dlat=39.9631018208&dlon=116.3406135236&dname=数字天堂公司&sname=我的位置&t=0&sourceApplication=io.dcloud.uniappx')">
  27. 使用高德地图打开地图坐标
  28. </button>
  29. <!-- #endif -->
  30. </view>
  31. </template>
  32. <script setup lang="uts">
  33. import { openSchema } from '@/uni_modules/uts-openSchema'
  34. </script>
  35. <style>
  36. .button {
  37. margin: 15px;
  38. }
  39. .tip {
  40. padding: 8px;
  41. }
  42. .link {
  43. color: #7A7E83;
  44. font-size: 14px;
  45. line-height: 20px;
  46. }
  47. </style>