将组件中的@click事件统一替换为@tap.stop,避免在小程序环境中可能出现的点击事件冒泡问题,提升交互体验的一致性。同时移除冗余的@tap事件绑定,保持代码简洁。 主要修改包括: - 表单提交按钮 - 分享功能 - 热区点击 - 富文本点击 - 视频播放 - 直播入口 - 商品品牌 - 客服功能 - 快捷导航 - 公告弹窗 - 文章列表 - 底部导航 - 商品列表 - 浮动按钮 - 优惠券 - 搜索功能 - 店铺相关 - 文本组件 - 分类页面 - 魔方组件 - 秒杀功能 - 拼团功能 - 预售功能 - 砍价功能 - 分销商品 - 图片广告 - 支付二维码 - 图片导航 - 音频控制 - 地图导航 - 笔记功能 - 商户列表 - 图片组件 - 会员订单 - 图文导航 - 首页分类 - 商品推荐 - 团购功能 - 限时折扣 - 商品分类 - 商品列表 - 优惠券 - 搜索功能 - 店铺相关 - 文本组件 - 分类页面 - 魔方组件 - 秒杀功能 - 拼团功能 - 预售功能 - 砍价功能 - 分销商品 - 图片广告 - 支付二维码 - 图片导航 - 音频控制 - 地图导航 - 笔记功能 - 商户列表 - 图片组件 - 会员订单 - 图文导航 - 首页分类 - 商品推荐 - 团购功能 - 限时折扣 - 商品分类
67 lines
1.6 KiB
Vue
67 lines
1.6 KiB
Vue
<template>
|
|
<view data-component-name="diy-rich-text" class="rich-text-box" :style="richTextWarpCss">
|
|
<rich-text :nodes="html" @tap.stop="handlerClick"></rich-text>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
// 富文本
|
|
import htmlParser from '@/common/js/html-parser';
|
|
import DiyMinx from './minx.js'
|
|
export default {
|
|
name: 'diy-rich-text',
|
|
props: {
|
|
value: {
|
|
type: Object
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
html: ''
|
|
};
|
|
},
|
|
created() {
|
|
this.html = htmlParser(this.value.html);
|
|
},
|
|
mixins: [DiyMinx],
|
|
watch: {
|
|
// 组件刷新监听
|
|
componentRefresh: function (nval) { }
|
|
},
|
|
computed: {
|
|
richTextWarpCss: function () {
|
|
var obj = '';
|
|
obj += 'background-color:' + this.value.componentBgColor + ';';
|
|
if (this.value.componentAngle == 'round') {
|
|
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
|
|
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
|
|
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
|
|
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
|
|
}
|
|
return obj;
|
|
}
|
|
},
|
|
mounted() { },
|
|
methods: {
|
|
async handlerClick(item) {
|
|
await this.__$emitEvent({
|
|
eventName: 'rich-text-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
|
|
if (!awaitedResult) return;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.rich-text-box {
|
|
padding: $padding;
|
|
box-sizing: border-box;
|
|
height: auto;
|
|
line-height: 1.5;
|
|
white-space: pre-wrap;
|
|
word-break: break-all;
|
|
}
|
|
</style>
|