|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
- <swiper class="ybr-swiper-container"
|
|
|
- :class="{'swiper-no-swiping': arrBanner.length === 1}"
|
|
|
- :options="ybrSWOptions"
|
|
|
- v-if="arrBanner.length">
|
|
|
+ <swiper class="ttyf-swiper-container"
|
|
|
+ :options="ttyfSWOptions"
|
|
|
+ v-if="arrBanner.length"
|
|
|
+ ref="ttyfSwiper">
|
|
|
<swiper-slide v-for="(item, index) in arrBanner"
|
|
|
:key="index">
|
|
|
<img class="banner"
|
|
@@ -31,23 +31,42 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ybrSWOptions () {
|
|
|
- return {
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ ttyfSWOptions: {
|
|
|
loop: true,
|
|
|
autoplay: this.arrBanner.length > 1,
|
|
|
pagination: {
|
|
|
el: '.sw-pagination',
|
|
|
clickable: true
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ click: this.handleClick
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleClick () {
|
|
|
+ // bannerType:1 跳转链接,0 富文本
|
|
|
+ const ttyfSwiper = this.$refs.ttyfSwiper.swiper
|
|
|
+ const { bannerType, url, id } = this.arrBanner[ttyfSwiper.realIndex]
|
|
|
+ switch (bannerType) {
|
|
|
+ case 0:
|
|
|
+ this.$router.push({ name: 'loanMedia', params: { id } })
|
|
|
+ break
|
|
|
+ case 1:
|
|
|
+ location.href = url
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.ybr-swiper-container {
|
|
|
+.ttyf-swiper-container {
|
|
|
.banner {
|
|
|
display: block;
|
|
|
width: 100%;
|