https://developers.weixin.qq.com/community/develop/doc/0004a8f5c34fb8287ade6f37256800
mp-icon在kbone中为什么会报错?[图片] [图片][图片] 页面能展示,但是控制台报错
2022-11-15修改custom-component->index.wxml中的mp-icon组件 <mp-icon wx:elif="{{kboneCustomComponentName === 'mp-icon'}}" id="{{id}}" 修改为: <mp-icon wx:elif="{{kboneCustomComponentName === 'mp-icon' && !!type}}" id="{{id}}" // 直接使用webpack插件进行修复 // 在build目录下创建FixeMpIconPlugin.js文件 // 在webpack.mp.config.js中使用即可 const path = require('path') const fs = require('fs') class FixeMpIconPlugin { apply(compiler) { compiler.hooks.done.tap('fixeMpIcon', () => { const customComponent = path.resolve(__dirname, '../dist/mp/custom-component/index.wxml') let indexWxml = fs.readFileSync(customComponent).toString() indexWxml = indexWxml.replace(`{{kboneCustomComponentName === 'mp-icon'}}`, `{{kboneCustomComponentName === 'mp-icon' && !!type}}`) fs.writeFileSync(customComponent, indexWxml) return true }) } } module.exports = FixeMpIconPlugin
<mp-icon>组件在kbone中一直报错?[图片]
2022-11-15