在main.js中:常会有

new Vue({
el: '#app',
router,//实例化,表示会使用
render: h => h(App)//vue2.0写法

//以下是vue1.0的写法
//components: { App },//注册组件信息
// template: '<App/>'//简写的模板调用组件的标签
})

components: { App }
 template: '<App/>'
或者

render: h => h(App)的代码。
render:function(h){
      return h(App)
      }
render:function(createElement){
  return createElement(App)    
  }
实际上这两行代码的作用是一样的,
只是render: h => h(App)是 vue2.0的语法
      components: { App }是vue1.0的语法,
作用是渲染视图,并给el挂载


相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-08-27
  • 2021-09-19
  • 2022-12-23
相关资源
相似解决方案