Vue 中使用插槽(slot)
案例:子组件中的一部分内容是根据父组件传递来的 DOM 来进行显示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue 中使用插槽(slot)</title>
<script src="./vue.js"></script>
</head>
<body>
<div id="root">
<child content='<p>Dell</p>'></child>
</div>
<script>
Vue.component('child',{
props:['content'],
template:'<div><p>hello</p><div v-html="this.content"></div></div>'
})
var vm = new Vue({
el:'#root',
})
</script>
</body>
</html>
输出: