vue $scopedSlots作用域插槽
<body><div id="app"><my-component><h1 slot-scope="props">{{props.text}}</h1></my-component>&
·
<body>
<div id="app">
<my-component>
<h1 slot-scope="props">{{props.text}}</h1>
</my-component>
</div>
<script>
Vue.component('my-component',{
render: function (createElement) {
return createElement('div',[createElement('div',{domProps:{innerHTML:'this child div'}}),
this.$scopedSlots.default({
text:'hello world'
})
])
}
})
var vm = new Vue({
el:'#app',
})
</script>
</body>
更多推荐
已为社区贡献4条内容
所有评论(0)