上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 58 下一页
摘要: 作用域插槽 <div id='root'> <child> <template slot-scope='props'> <h1>{{props.item}}</h1> </template> </child> </div> <script> Vue.component('child',{ data: 阅读全文
posted @ 2018-09-19 06:30 wzndkj 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 插槽(slot)这个概念非常重要 插槽的使用场景1:在子组件里面显示父组件的dom <div id='root'> <child content = '<p>Dell</p>'></child> </div> <script> Vue.component('child',{ props:['cont 阅读全文
posted @ 2018-09-18 06:51 wzndkj 阅读(841) 评论(0) 推荐(0) 编辑
摘要: 当父组件要给孙子,或者孙子与孙子要传值的时候怎么传,一层一层传太麻烦了,vuejs提供了一中模式叫发布订阅模式(观察者模式,bus,总线)来处理非父子组件间的传值 <div id='root'> <child content = 'Dell'></child> <child content = 'L 阅读全文
posted @ 2018-09-17 07:07 wzndkj 阅读(532) 评论(0) 推荐(0) 编辑
摘要: 给组件绑定事件,该事件是自定义的事件 <div id='root'> <child @click='handleClick'></child> </div> <script> Vue.component('child',{ template:'<div>hello</div>' }) var vm 阅读全文
posted @ 2018-09-17 06:28 wzndkj 阅读(3899) 评论(0) 推荐(0) 编辑
摘要: 父组件向子组件传递一些参数,那么子组件有权对这些参数进行一个校验,这个就是组件参数校验 需求:父组件传递过来的必须是个字符串,这个要怎么去校验呢 <div id='root'> <child content='hello world'></child> </div> <script> Vue.com 阅读全文
posted @ 2018-09-16 08:51 wzndkj 阅读(3664) 评论(0) 推荐(0) 编辑
摘要: 在vue中,父组件往子组件传递参数都是通过属性的形式来传递的 <div id='root'> <counter :count = '1'></counter> <counter :count = '2'></counter> </div> <script> var counter = { props 阅读全文
posted @ 2018-09-15 11:27 wzndkj 阅读(3600) 评论(0) 推荐(0) 编辑
摘要: is属性 <div id='root'> <table> <tbody> <row></row> <row></row> <row></row> </tbody> </table> </div> <script> Vue.component('row',{ template:'<tr><td>th< 阅读全文
posted @ 2018-09-14 07:08 wzndkj 阅读(395) 评论(0) 推荐(0) 编辑
摘要: <div id='root'> <div v-for='(item,key,index) of userInfo'> {{item}}--{{key}}--{{index}} </div> </div> <script> var vm = new Vue({ el:'#root', data:{ u 阅读全文
posted @ 2018-09-13 06:40 wzndkj 阅读(609) 评论(0) 推荐(0) 编辑
摘要: 为了提升循环的性能,我们会给循环加上一个唯一的key值,这个key值一定是唯一的 <div id='root'> <div v-for='(item,index) of list' :key='index'> {{item}}--{{index}} </div> </div> <script> va 阅读全文
posted @ 2018-09-12 06:58 wzndkj 阅读(512) 评论(0) 推荐(0) 编辑
摘要: <div id='root'> <div v-if='show'>helle world</div> <button @click='handleClick'>toggle</button> </div> <script> new Vue({ el:'#root', data:{ show:true 阅读全文
posted @ 2018-09-11 07:03 wzndkj 阅读(17783) 评论(0) 推荐(0) 编辑
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 58 下一页