123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <view class="container">
- <swiper v-if="list.length" class="swiper" :indicator-dots="list.length > 1" :circular="true" indicator-color="#999"
- indicator-active-color="#fff">
- <swiper-item v-for="(item, index) in list" @click="preview(index)" :key="item.url">
- <image class="image" :src="item.url" mode="aspectFit" lazy-load="true" />
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- export default {
- name: "prodnum-06",
- props: {
- attinfos: Array
- },
- data() {
- return {
- list: []
- }
- },
- watch: {
- attinfos: function (newVal) {
- this.list = newVal.filter(v => v.usetype == "previewImage")
- }
- },
- methods: {
- preview(index) {
- console.log(index)
- uni.previewImage({
- current: index,
- urls: this.list.map(v => v.url),
- indicator: "number",
- loop: true,
- longPressActions: {
- itemList: ['发送给朋友', '保存图片', '收藏'],
- success: function (data) {
- console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
- },
- fail: function (err) {
- console.log(err.errMsg);
- }
- }
- });
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .container {
- .swiper {
- width: 355px;
- height: 158px;
- margin: 15px auto 0;
- .image {
- width: 355px;
- height: 158px;
- }
- }
- }
- </style>
|