qsh-webview-sdk 2.4.2 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,14 +56,20 @@ qsh.ready().then(() => {
56
56
  ```javascript
57
57
  import qsh from 'qsh-webview-sdk';
58
58
 
59
+ // 如果路由使用了hash模式,则只需在App.vue中config一次,url可以不传
60
+ // 如果是非hash模式, 则需要在每次路由变化时重新config, 且要传入完整的url
59
61
  if(qsh.environment.isWeixinMiniProgram) {
60
62
  qsh.config({
61
63
  clientId: 'your-client-id', // 注意区分生产和测试的clientId
62
- isProd: false
64
+ isProd: false,
65
+ debug: false, // isProd 为 true 时会强制关闭
66
+ url: '' // 可选:传入后用于微信签名,默认使用当前页面 URL
63
67
  })
64
68
  }
65
69
 
66
70
  // isProd 默认为 false: 根据环境传入
71
+ // debug 默认为 false: 仅在 isProd 为 false 时可开启
72
+ // url 默认为空: 有值时会替代当前页面 URL 参与微信签名
67
73
  // 依赖微信 JS-SDK 的能力前,建议先注入 clientId
68
74
  // 已调用 qsh.config() 时,qsh.ready() 会在微信小程序 web-view 中额外等待 wx.config 完成
69
75
  await qsh.ready();
@@ -492,8 +498,8 @@ try {
492
498
  ```javascript
493
499
  // 打开地图查看指定位置
494
500
  qsh.openLocation({
495
- latitude: 39.908823,
496
- longitude: 116.397470,
501
+ latitude: 39.908823, // 需传入wgs84坐标
502
+ longitude: 116.397470, // 需传入wgs84坐标
497
503
  name: '天安门',
498
504
  address: '北京市东城区东长安街',
499
505
  scale: 15, // 缩放级别 1-28
@@ -504,8 +510,8 @@ qsh.openLocation({
504
510
 
505
511
  // Promise 版本
506
512
  await qsh.openLocationAsync({
507
- latitude: 39.908823,
508
- longitude: 116.397470,
513
+ latitude: 39.908823, // 需传入wgs84坐标
514
+ longitude: 116.397470, // 需传入wgs84坐标
509
515
  name: '天安门'
510
516
  });
511
517
  ```
@@ -596,10 +602,9 @@ qsh.chooseLocation({
596
602
  latitude: 39.908823, // 初始纬度
597
603
  longitude: 116.397470, // 初始经度
598
604
  success: (res) => {
599
- console.log('选择位置:', res.name);
600
- console.log('地址:', res.address);
601
- console.log('纬度:', res.latitude);
602
- console.log('经度:', res.longitude);
605
+ console.log(res.location);
606
+ console.log(res.formatted_address);
607
+ console.log(res.addressComponent);
603
608
  },
604
609
  fail: (err) => console.error(err)
605
610
  });
@@ -626,20 +631,12 @@ qsh.printPdf({
626
631
  });
627
632
  ```
628
633
 
629
- ## 兼容性
630
-
631
- - 微信小程序 WebView
632
- - UniApp APP 端 (Android/iOS)
633
- - H5+ 环境
634
- - NVUE 页面
635
- - UVUE 页面 (UniApp X)
636
-
637
634
  ### 跳转其他微信小程序
638
635
 
639
636
  ```javascript
640
637
  qsh.navigateToMiniProgram({
641
- appid: ',
642
- path: ',
638
+ appid: '',
639
+ path: '',
643
640
  // release/trial/develop
644
641
  env: 'release',
645
642
  success: (res) => console.log('跳转成功', res),
@@ -668,6 +665,14 @@ qsh.manualShare({
668
665
  对于isPublic:true时 用户点击分享的内容后会直接从基座首页跳转到h5Url, 对于isPublic:false时,基座完成登录流程后会携带参数h5Url=${encodeURIComponent(h5Url)}跳转到业务配置的h5首页, 在h5首页获取code和h5Url后根据需要自行处理登录逻辑和跳转
669
666
  此方法会销毁当前H5页面并返回小程序基座
670
667
 
668
+ ## 兼容性
669
+
670
+ - 微信小程序 WebView
671
+ - UniApp APP 端 (Android/iOS)
672
+ - H5+ 环境
673
+ - NVUE 页面
674
+ - UVUE 页面 (UniApp X)
675
+
671
676
  ## License
672
677
 
673
678
  MIT
@@ -699,7 +704,9 @@ onMounted(async () => {
699
704
  if (qsh.environment.isWeixinMiniProgram) {
700
705
  qsh.config({
701
706
  clientId: '', // 注意区分生产和测试的clientId
702
- isProd: import.meta.env.MODE === 'production'
707
+ isProd: import.meta.env.MODE === 'production',
708
+ debug: false,
709
+ url: ''
703
710
  })
704
711
  }
705
712