jin-yufeng / mp-html

小程序富文本组件,支持渲染和编辑 html,支持在微信、QQ、百度、支付宝、头条和 uni-app 平台使用
https://jin-yufeng.gitee.io/mp-html
MIT License
3.26k stars 477 forks source link

plus is not defined #554

Closed jonsen-liu closed 7 months ago

jonsen-liu commented 10 months ago

微信小程序使用 报错 ReferenceError: plus is not defined

使用环境

问题描述

复现方式

jonsen-liu commented 10 months ago

image

jonsen-liu commented 10 months ago

没人知道是什么问题么?

jin-yufeng commented 10 months ago

plus 是条件编译到 app 端的,不知道你是怎么使用的,参考一下示例吧

XieMiLe commented 9 months ago

我的项目中也复现了,大部分富文本是正常的,只有这一段富文本是报错的,怀疑是html的导致的。<img src="https://p4.itc.cn/images01/20230302/172da1d8821f4218b45a523303c684ee.png" srcset="" />

一段一段测试了一下,img标签上包含 srcset="" 时,就会报错。

看样子是 srcset 与 src 混淆了,影响了 第1298行this.content.substring(this.start, this.i)

jin-yufeng commented 7 months ago

getUrl 里的 plus 是条件编译到 app 端的,正常编译到微信小程序是不会有的
如果是 cli 编译的要注意 https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687