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

This commit is contained in:
puhui999
2025-01-07 16:08:57 +08:00
parent bc0e731fc3
commit 53899380c3
+4 -3
View File
@@ -60,7 +60,7 @@
/** /**
* 模板组件 - 提供页面公共组件,属性,方法 * 模板组件 - 提供页面公共组件,属性,方法
*/ */
import { computed } from 'vue'; import { computed, onMounted } from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { isEmpty } from 'lodash-es'; import { isEmpty } from 'lodash-es';
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@@ -212,11 +212,12 @@
}); });
// #endif // #endif
onShow(() => { // 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
onMounted(()=>{
if (!isEmpty(shareInfo.value)) { if (!isEmpty(shareInfo.value)) {
sheep.$platform.share.updateShareInfo(shareInfo.value); sheep.$platform.share.updateShareInfo(shareInfo.value);
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>