mall-uniapp/pages/index/index.vue

70 lines
1.6 KiB
Vue
Raw Normal View History

2022-11-22 07:45:36 +00:00
<template>
<view v-if="template">
2023-11-03 01:18:03 +00:00
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
:navbarStyle="template.style?.navbar" onShareAppMessage>
2023-11-03 01:18:03 +00:00
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.style">
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
<!-- 广告模块 -->
<s-popup-image />
</s-layout>
</view>
2022-11-22 07:45:36 +00:00
</template>
<script setup>
import {
computed
} from 'vue';
import {
onLoad,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';
// 隐藏原生tabBar
uni.hideTabBar();
2022-11-22 07:45:36 +00:00
const template = computed(() => sheep.$store('app').template?.home);
2022-11-22 07:45:36 +00:00
onLoad((options) => {
// #ifdef MP
// 小程序识别二维码
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split('=');
options[sceneParams[0]] = sceneParams[1];
}
// #endif
2022-11-22 07:45:36 +00:00
// 预览模板
if (options.templateId) {
sheep.$store('app').init(options.templateId);
}
2022-11-22 07:45:36 +00:00
// 解析分享信息
if (options.spm) {
$share.decryptSpm(options.spm);
}
2022-11-22 07:45:36 +00:00
// 进入指定页面(完整页面路径)
if (options.page) {
sheep.$router.go(decodeURIComponent(options.page));
}
2022-11-22 07:45:36 +00:00
// TODO 芋艿:测试接口的调用
sheep.$api.app.test();
});
2023-10-29 14:01:20 +00:00
// 下拉刷新
onPullDownRefresh(() => {
sheep.$store('app').init();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 800);
});
2022-11-22 07:45:36 +00:00
onPageScroll(() => {});
2022-11-22 07:45:36 +00:00
</script>
2023-11-03 01:18:03 +00:00
<style></style>