complete code:
< html lang= "en" >
< head >
<meta charset="UTF-8">
<title>Vue</title>
<link rel="stylesheet" href="./main.css">
<script src="./vue.js"></script>
< / head >
< body >
<h1>Vue</h1>
<hr>
<strong></strong>
<div id="app">
<child>
<div slot-scope="news">
<li v-for="item in news.news" >{{item}}</li>
<li>{{news}}</li>
<li>{{news.news}}</li>
</div>
</child>
</div>
<script>
Vue.component("child",{
data(){
return{
news:[
"iphone"
,""
,"F4 "
,""
,""
,""
,""
,""
,""
],
}
},
template:`
<div>
:
<slot :news="news"></slot>
</div>
`
})
var vm = new Vue({
el:"-sharpapp",
})
</script>
< / body >
< / html >
question: the scope slot binds the news array through attributes, but why is an object received through slot-scope="news"? Please explain, thank you