vue222/10-组件化开发/09-组件插槽使用/复习/复习作用域插槽.html

48 lines
931 B
HTML
Raw Permalink Normal View History

2022-11-07 15:17:03 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<apps>
<div slot-scope="data">
<ul v-for="item in data">
<div>{{item.join("__*__")}}</div>
</ul>
</div>
</apps>
<apps></apps>
</div>
<template id="tpl">
<div>
<slot :data="list">
<div v-for="item in list">
{{item}}
</div>
</slot>
</div>
</template>
</body>
2022-11-19 11:23:13 +08:00
<script src="../../../00-tools/JavaScript/vue.js"></script>
2022-11-07 15:17:03 +08:00
<script>
new Vue({
el:"#app",
components:{
'apps':{
template:"#tpl",
data(){
return {
list: ['这是内容1', '这是内容2', '这是内容3']
}
}
}
}
})
</script>
</html>