一 模版文件

 

<div>
  <header>
    <h1>I'm a template!</h1>
  </header>
  <p v-if="message">{{ message }}</p>
  <p v-else>No message.</p>
</div>

 

二 渲染函数(render)

 

function anonymous() {
  with (this) {
    return _c("div", [
        // header部分
        _m(0),
        // if-else部分
        message ? 
            _c("p", [_v(_s(message))]) : 
            _c("p", [_v("No message.")])
    ]);
  }
}

 

三 静态渲染函数(staticRenderFns)

 

_m(0): function anonymous() {
  with (this) {
    return _c("header", [
        _c("h1", [
            _v("I'm a template!")
        ])
    ]);
  }
}

 

相关文章:

  • 2023-03-27
  • 2021-05-27
  • 2022-12-23
  • 2021-04-20
  • 2021-12-01
  • 2021-04-27
  • 2021-10-01
猜你喜欢
  • 2022-01-18
  • 2021-04-11
  • 2022-12-23
  • 2021-12-25
  • 2021-09-19
  • 2021-06-03
  • 2021-07-28
相关资源
相似解决方案