Skip to content

Commit 9d797ad

Browse files
committed
轮播组件的click事件有bug,改为router-link
1 parent 9883140 commit 9d797ad

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/components/home/Banner.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<div class="wrap-swiper">
44
<swiper v-if="banner.length > 0" :options="swiperOption" ref="mySwiper" @someSwiperEvent="callback">
55
<swiper-slide v-for="(item, index) in banner" :key="index">
6-
<span @click="toUrl(item.url)">
6+
<router-link :to="item.url">
77
<img :src="item.img" alt="">
8-
</span>
8+
</router-link>
99
</swiper-slide>
1010
<div class="swiper-pagination" slot="pagination"></div>
1111
</swiper>
@@ -37,9 +37,6 @@ export default class HomeBanner extends Vue {
3737
private callback() {
3838
console.log('run');
3939
}
40-
private toUrl(url: string) {
41-
this.$router.push(url);
42-
}
4340
get banner() {
4441
return this.$store.state.homeBanner;
4542
}

0 commit comments

Comments
 (0)