【类 型】:style

【主	题】:取消多余判断
【描	述】:
	[原因]:入口时直接请求接口 获取数据 不用判断有没有
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-06-12 18:42:20 +08:00
parent be06835a6d
commit 1efa9308f2

20
App.vue
View File

@ -3,27 +3,17 @@
//
onLaunch: function() {
//
if (Object.keys(this.$store.state.shopCon).length === 0) {
this.$store.dispatch('fetchShopCon')
}
this.$store.dispatch('fetchShopCon')
//
if (this.$store.state.siteList.length === 0) {
this.$store.dispatch('fetchSiteList')
}
this.$store.dispatch('fetchSiteList')
//
if (this.$store.state.menuList.length === 0) {
this.$store.dispatch('fetchMenuList')
}
this.$store.dispatch('fetchMenuList')
// Promise
const promises = [];
//spu
if (this.$store.state.spuList.length === 0) {
promises.push(this.$store.dispatch('fetchSpuList'))
}
promises.push(this.$store.dispatch('fetchSpuList'))
//sku
if (this.$store.state.skuList.length === 0) {
promises.push(this.$store.dispatch('fetchSkuList'))
}
promises.push(this.$store.dispatch('fetchSkuList'))
//sku spu
Promise.all(promises).then(() => {
this.$store.commit('addMinPriceToSpuList') //spu