https://taro-docs.jd.com/taro/next/docs/next/html.html


// Taro 更推荐使用框架自带的渲染 HTML 方式
// 因为不管 React/Nerv/Vue 都会自带一个 diff 机制,可以避免不必要的渲染的开销
// 重复调用 `innerHTML` 会使得应用的性能拖慢。

import { document } from '@tarojs/runtime'

class HelloWorld extends React.Component {
  componentDidMount () {
    const el = document.getElementById('html')

    el.innerHTML = `<h1 style="color: red">Wallace is way taller than other reporters.</h1>`
  }

  render () {
    return <View  />
  }
}

taro 渲染 html

生命周期

https://nervjs.github.io/taro/docs/taroize.html#生命周期

taro 渲染 html



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2021-09-14
  • 2021-12-22
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-07-19
  • 2021-09-21
  • 2021-11-30
相关资源
相似解决方案