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#生命周期

本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/12651532.html
未经授权禁止转载,违者必究!

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号