12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- define([
- 'swiper',
- 'text!components/recommend/advert/index.html',
- 'css!components/recommend/advert/index.css'
- ], function(Swiper, html) {
- return {
- props: {
- advertList: {
- type: Array,
- default: function () {
- return [];
- }
- }
- },
- data: function () {
- return {
- swiperOptions: {
- autoplay: true,
- loop: true,
- pagination: {
- el: '.advert-pagination'
- },
- uniqueNavElements: false
- }
- };
- },
- mounted: function () {
- this.$nextTick(function () {
- this.swiper7 = new Swiper('#swiper7', this.swiperOptions);
- });
- },
- methods: {
- advertClick: function () {
- var url = this.swiper7.clickedSlide.dataset.url;
- if (url.indexOf('http') === -1 || url.indexOf('http')) {
- return;
- }
- window.location = url;
- }
- },
- template: html
- };
- });
|