Authored by 陈峰

commit

... ... @@ -22,6 +22,11 @@ export default ['AwesomeSwiper', function AwesomeSwiper() {
},
name: String
},
mounted() {
if (this[this.name] && this.$parent) {
this.$parent[this.name] = this[this.name];
}
},
render: function(h) {
return h('div', {
directives: [{
... ...
<template>
<div class="focus-image">
<awesome-swiper name="mySwiper" :options="swiperOption" class="swipe">
<div class="swiper-wrapper">
<div class="swiper-wrapper" @click="activeLink">
<div class="swiper-slide"
v-for="focus in value"
:key="focus.src"
:style="{backgroundColor: focus.bgColor}">
<a-link :href="focus.url">
<img-format :src="focus.src" :w="375" :h="240"></img-format>
</a-link>
</div>
</div>
<div class="swiper-pagination"></div>
</awesome-swiper>
<a-link ref="linkA" :href="activeHref"></a-link>
</div>
</template>
... ... @@ -26,6 +25,7 @@
},
data() {
return {
activeHref: '',
swiperOption: {
loop: true,
autoplay: true,
... ... @@ -33,6 +33,18 @@
el: '.swiper-pagination'
}
}
};
},
methods: {
activeLink() {
const img = this.value[this.mySwiper.realIndex];
if (img) {
this.activeHref = img.url;
this.$nextTick(() => {
this.$refs.linkA.click();
});
}
}
},
components: {Resource}
... ...