taro icon indicating copy to clipboard operation
taro copied to clipboard

最新版 taro 的 dangerouslySetInnerHTML 无法解析嵌套标签

Open json-q opened this issue 1 year ago • 0 comments

相关平台

微信小程序

小程序基础库: 3.4.5 使用框架: React

复现步骤

 // const html = `<div style="font-size: 14px">this is true</div>`
  const html = `<div style="font-size: 14px"><span>this is problem</span></div>`

  return <View  className='taro_html'  dangerouslySetInnerHTML={{ __html: html }} />

以上代码就是最小复现,之前使用的 3.6.26 是可以正常使用的,升级到最新版出现模板错误,问题如下:

image

期望结果

修复此问题

实际结果

模板解析错误

环境信息

👽 Taro v3.6.30


  Taro CLI 3.6.30 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 20.12.1 - D:\Node\node.EXE
      Yarn: 1.22.22 - D:\Node\yarn.CMD
      npm: 10.5.0 - D:\Node\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.31 => 3.6.31
      @tarojs/components: 3.6.31 => 3.6.31
      @tarojs/helper: 3.6.31 => 3.6.31
      @tarojs/plugin-framework-react: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-alipay: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-h5: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-jd: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-qq: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-swan: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-tt: 3.6.31 => 3.6.31
      @tarojs/plugin-platform-weapp: 3.6.31 => 3.6.31
      @tarojs/react: 3.6.31 => 3.6.31
      @tarojs/runtime: 3.6.31 => 3.6.31
      @tarojs/shared: 3.6.31 => 3.6.31
      @tarojs/taro: 3.6.31 => 3.6.31
      @tarojs/taro-loader: 3.6.31 => 3.6.31
      @tarojs/webpack5-runner: 3.6.31 => 3.6.31
      babel-preset-taro: 3.6.31 => 3.6.31
      eslint-config-taro: 3.6.31 => 3.6.31
      react: ^18.0.0 => 18.3.1

json-q avatar Jun 05 '24 02:06 json-q