<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui/lib/index.js"></script>
<div id="div1">
<child :level="2">Hello world!</child>
</div>
<script>

Vue.component('child', {
render: function (createElement) {
return createElement(
'h' + this.level, // tag name 标签名称
this.$slots.default // 子组件中的阵列
)
},
props: {
level: {
type: Number,
required: true
}
}
})

 
     

new Vue({
el:"#div1"
})


</script>

 

posted on 2017-03-26 11:23 778323309 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/jiaochengli/p/6622150.html

Logo

前往低代码交流专区

更多推荐