feat(custom): 完善幻灯片功能

This commit is contained in:
2023-12-15 20:51:32 +08:00
parent 878c421fe0
commit 3c5ce5bba3
3 changed files with 47 additions and 3 deletions

View File

@@ -13,7 +13,11 @@
auto-play="3000"
>
<nut-swiper-item v-for="(itm, idx) in bannerList" :key="idx">
<img :src="itm.url" :alt="itm.ID.toString()" />
<img
:src="itm.url"
:alt="itm.ID.toString()"
@click="toPage(itm.jump)"
/>
</nut-swiper-item>
</nut-swiper>
</view>
@@ -44,6 +48,8 @@ import Popup from "@/components/Popup.vue";
import MerList from "@/components/MerList.vue";
import { getHomeList } from "@/api/home";
import { getBanner } from "@/api/user";
import { parseQueryString } from "@/utils";
import { getMerList } from "@/api/goods";
const searchValue = ref("");
@@ -127,6 +133,19 @@ const toDetails = (item: SwiperList) => {
url: item.url as string,
});
};
const toPage = async (url: string) => {
// url转对象
const obj = parseQueryString(url);
if (obj.type === "1") {
const { data: res } = await getMerList({});
const mer = res.data.filter((item) => item.bid === obj.bid)[0];
Taro.setStorageSync("mer_info", mer);
}
Taro.navigateTo({
url,
});
};
</script>
<style lang="scss">