标签:baidu this 传递 vue put har method meta eth
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>vue-dmeo</title> <script src="http://libs.baidu.com/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> </head> <body> <div id="page"> <input type="text" v-model="mess"> <button @click="clickChild">父向子传递</button> <hellow></hellow> </div> <script type="text/javascript" src="//cdn.bootcss.com/vue/1.0.26/vue.js"></script> <script> var handle= function(){ var hellow = { template:"{{arr|json}}", data:function(){ return { arr:[] } }, events:{ ‘addNew‘:function(val){ this.arr.push(val); } } } return new Vue({ el:"#page", data:{ mess:‘‘ }, methods:{ clickChild:function(){ this.$broadcast(‘addNew‘,this.mess.trim()); this.mess = ‘‘; } }, components:{ hellow:hellow, } }) }() </script> </body> </html>
vuejs 父组件向子组件传递($broadcast()的用法)
标签:baidu this 传递 vue put har method meta eth
原文地址:http://www.cnblogs.com/zhujiasheng/p/6287770.html