41-vue中-接口main.js中-render渲染函数(简化了映射组件为标签、使用标签的写法)

1.使用render渲染函数之前的写法

new Vue({
    
    
  el:"#app",
  components:{
    
    
    App
  },
  template:"<App/>"
})

2.使用render渲染函数之后的写法

render渲染函数,相当于将component属性和template属性二者的代码换作了简化写法

new Vue({
    
    
  el:"#app",
  render:h => h(App)//传入的参数h是一个函数createElement()函数的对象
})

3.render渲染函数的原本写法

new Vue({
    
    
  el:"#app",
  //render:h=>h(App)//常用render的箭头形式的写法
  render: function(createElement){
    
    
  	 return createElement(App);
  }
})

猜你喜欢

转载自blog.csdn.net/A_Bow/article/details/114629885
今日推荐