已更新至父组件传递子组件数据
This commit is contained in:
parent
4ae800c474
commit
a3aa85c9cb
|
@ -1,45 +0,0 @@
|
|||
<!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 @contents="isShower"></apps>
|
||||
</div>
|
||||
<template id="tpl">
|
||||
<div>
|
||||
<h1 v-for="item in list" @click="Isdatas(item)"></h1>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
<script src="../../../JavaScript/vue.js"></script>
|
||||
<script>
|
||||
const vue=new Vue({
|
||||
el:"#app",
|
||||
methods: {
|
||||
isShower(item){
|
||||
console.log(item);
|
||||
}
|
||||
},
|
||||
components:{
|
||||
'apps':{
|
||||
template:"#tpl",
|
||||
data(){
|
||||
return {
|
||||
list:['内容1','内容2','内容3','内容4']
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
Isdatas(item){
|
||||
this.$emit('contents', item)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</html>
|
Loading…
Reference in New Issue