提交 7e66f9cb authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 7de7529d
......@@ -18,10 +18,19 @@ export const useShopStore = defineStore({
list: (window as any).SHOP.SHOP_LIST // 商品列表
}),
getters: {
shopItem: ({ list }) => {
shopItem({ list }) {
const route = useRoute()
console.log(list)
return list.find(item => item.id === route.params.id)
const found = list.find(item => item.id === route.params.id)
if (found) {
found.course_list =
found.child_ids && found.child_ids.length
? found.child_ids.map((id: string) => list.find(item => item.id === id))
: list.filter(item => item.child_ids?.includes(found.id))
}
return found
},
relatedShopList({ list }): ShopListItem[] {
return list.filter((item: ShopListItem) => item.category !== this.shopItem?.category)
}
},
actions: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论