<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>
vue $scopedSlots作用域插槽
最新推荐文章于 2025-02-24 00:10:06 发布