Browse Source

【缺陷修复】s-layout 组件中使用 onMounted 监听页面加载,解决 H5 中分享信息获取失败的问题

puhui999 7 months ago
parent
commit
53899380c3
1 changed files with 4 additions and 3 deletions
  1. 4 3
      sheep/components/s-layout/s-layout.vue

+ 4 - 3
sheep/components/s-layout/s-layout.vue

@@ -60,7 +60,7 @@
   /**
    * 模板组件 - 提供页面公共组件,属性,方法
    */
-  import { computed } from 'vue';
+  import { computed, onMounted } from 'vue';
   import sheep from '@/sheep';
   import { isEmpty } from 'lodash-es';
   // #ifdef MP-WEIXIN
@@ -212,11 +212,12 @@
   });
   // #endif
 
-  onShow(() => {
+  // 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
+  onMounted(()=>{
     if (!isEmpty(shareInfo.value)) {
       sheep.$platform.share.updateShareInfo(shareInfo.value);
     }
-  });
+  })
 </script>
 
 <style lang="scss" scoped>