taro 渲染 html
阅读原文时间:2023年07月09日阅读:1

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



手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章