vue222/10-组件化开发/07-父子组件的通信/07-2子组件向父组件的通信(emit)/复习/复习父传子的练习.html

41 lines
821 B
HTML

<!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 :app="list"></apps>
</div>
<template id="apps">
<div>
<h1 v-for="item in app">{{item}}</h1>
</div>
</template>
</body>
<script src="../../../00-tools/JavaScript/vue.js"></script>
<script>
const vue=new Vue({
el:"#app",
data:{
list:["这是图片1","这是图片2","这是图片3"]
},
components:{
'apps':{
template:"#apps",
props:{
'app':{
type:Array,
default(){
return []
}
}
}
}
}
})
</script>
</html>