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