将组件中的@click事件统一替换为@tap.stop,避免在小程序环境中可能出现的点击事件冒泡问题,提升交互体验的一致性。同时移除冗余的@tap事件绑定,保持代码简洁。 主要修改包括: - 表单提交按钮 - 分享功能 - 热区点击 - 富文本点击 - 视频播放 - 直播入口 - 商品品牌 - 客服功能 - 快捷导航 - 公告弹窗 - 文章列表 - 底部导航 - 商品列表 - 浮动按钮 - 优惠券 - 搜索功能 - 店铺相关 - 文本组件 - 分类页面 - 魔方组件 - 秒杀功能 - 拼团功能 - 预售功能 - 砍价功能 - 分销商品 - 图片广告 - 支付二维码 - 图片导航 - 音频控制 - 地图导航 - 笔记功能 - 商户列表 - 图片组件 - 会员订单 - 图文导航 - 首页分类 - 商品推荐 - 团购功能 - 限时折扣 - 商品分类 - 商品列表 - 优惠券 - 搜索功能 - 店铺相关 - 文本组件 - 分类页面 - 魔方组件 - 秒杀功能 - 拼团功能 - 预售功能 - 砍价功能 - 分销商品 - 图片广告 - 支付二维码 - 图片导航 - 音频控制 - 地图导航 - 笔记功能 - 商户列表 - 图片组件 - 会员订单 - 图文导航 - 首页分类 - 商品推荐 - 团购功能 - 限时折扣 - 商品分类
83 lines
2.6 KiB
Vue
83 lines
2.6 KiB
Vue
<template>
|
|
<view data-component-name="diy-picture" class="diy-picture" :style="style">
|
|
<view class="fui-picture">
|
|
<view v-for="(item, index) in value.list" style="line-height: 0;">
|
|
<image mode="widthFix" style="width: 100%;height:auto" :src="$util.img(item.imageUrl)"
|
|
v-if="item.link.wap_url" @tap.stop="handlerClick(item)"></image>
|
|
<image mode="widthFix" style="width: 100%;height:auto" :src="$util.img(item.imageUrl)" v-else
|
|
@tap.stop="handlerClick(item)"></image>
|
|
</view>
|
|
<!-- <view wx:if="{{!childitem.linkurl}}" bindtap="previewImg" data-src="{{childitem.imgurl}}" style="padding:{{diyitem.style.paddingtop==0?0:diyitem.style.paddingtop+'rpx'}} {{diyitem.style.paddingleft==0?0:diyitem.style.paddingleft+'rpx'}}" wx:for="{{diyitem.data}}" wx:for-index="childid" wx:for-item="childitem" wx:key="{{childid}}">
|
|
<image mode="widthFix" src="{{childitem.imgurl}}" style="{{bannerheight?'height:'+bannerheight+'px':'height:auto'}}"></image>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import DiyMinx from './minx.js'
|
|
export default {
|
|
name: 'diy-picture',
|
|
props: {
|
|
value: {
|
|
type: Object
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
loading: true,
|
|
};
|
|
},
|
|
created() {
|
|
// this.getDataList();
|
|
},
|
|
watch: {
|
|
// 组件刷新监听
|
|
componentRefresh: function (nval) {
|
|
// this.getDataList();
|
|
}
|
|
},
|
|
mixins: [DiyMinx],
|
|
computed: {
|
|
style() {
|
|
var css = '';
|
|
css += 'background-color:' + this.value.contentBgColor + ';';
|
|
if (this.value.elementAngle == 'round') {
|
|
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
|
|
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
|
|
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
|
|
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
|
|
}
|
|
return css;
|
|
}
|
|
},
|
|
methods: {
|
|
redirectTo(link) {
|
|
if (link.wap_url) {
|
|
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
|
this.$refs.login.open(link.wap_url);
|
|
return;
|
|
}
|
|
}
|
|
this.$util.diyRedirectTo(link);
|
|
},
|
|
|
|
async handlerClick(item) {
|
|
await this.__$emitEvent({
|
|
eventName: 'picture-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
|
|
if (!awaitedResult) return;
|
|
|
|
const link = item.link;
|
|
if (link?.name || link?.wap_url || link?.appid) {
|
|
this.redirectTo(item.link);
|
|
} else {
|
|
this.previewImg(item.imageUrl);
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss"></style> |