vue/10-组件化开发/07-父子组件的通信/07-1父组件向子组件的通信(props)/props属性的使用.html

51 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 :new_-lists="list">
<!--
v-bind标签是不支持驼峰标识因此在v-bind中如果要是使用驼峰标识就必须使用-进行连接转译
-->
</apps>
</div>
</body>
<template id="tpl">
<div>
<h1>{{new_Lists}}</h1>
</div>
</template>
<script src="../../../00-tools/JavaScript/vue.js"></script>
<script>
const vue=new Vue({
el:"#app",
data:{
list:['列表项1', '列表项2', '列表项3', '列表项4', '列表项5', '列表项6']
},
components:{
'apps':{
template:"#tpl",
// 1、props:['new_lists']
props:{
new_Lists:{
type:Array,
default(){
return ['None']
},
}
}
// 3、props:{
// new_lists(val){
// return ['列表项1'].indexOf(val)!=-1
// }
// }
}
}
})
</script>
</html>