taro 渲染 html


taro 渲染 html

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 id="html" />
  }
}

生命周期

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




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM