TA的每日心情 | 慵懒 2018-1-12 14:53 |
---|
签到天数: 2 天 [LV.1]初来乍到
新手上路
- 积分
- 48
|
<template>
<section class="scroll-wrapper" :style="{ height: clientHeight + 'px' }">
<section class="main-wrapper">
<swiper ptions="swiperOption">
<div class="swiper-slide" v-for="picture in pictures">
<div class="swiper-zoom-container">
<img class="swiper-img" v-bind:src="picture.url"/>
</div>
</div>
<div v-show="pictures.length > 1" class="swiper-pagination" slot="pagination"></div>
</swiper>
</section>
</section>
</template>
<script>
import {getScrollTop, getWindowHeight, setDocumentTitle} from '../../../../../static/h5/utils/interaction'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import PackageSpecs from '../../components/PackageSpecs'
import Btn from '../../components/Btn'
export default {
data () {
return {
newsId: '',
pictures: [],
bullets: true,
clientHeight: 0,
swiperOption: {
zoom: true,
notNextTick: true,
mode: 'horizontal',
speed: 300,
loop: false,
observer: true,
observeParents: true,
pagination: '.swiper-pagination',
paginationClickable: true,
spaceBetween: 30
}
}
},
ready () {
let params = {
newsId: this.$route.query.newsId
}
this.$resource('main/news/get-news-detail').get(params).then((resp) => {
let news = resp.data.item
this.pictures = news.pictures
})
setDocumentTitle('品牌要闻')
},
components: {
swiper,
swiperSlide,
PackageSpecs,
Btn
}
}
</script>
<style lang="less" scoped>
@import "./shownewspictures.less";
</style>
是在vue里面引入的swiper,之前用多个div包裹img,用静态的图片url 一切都可以正常使用,换上v-for之后 动态的从后台拿数据就出现手滑放大失效,双击放大,图片无法拖动的情况
|
|