摘要: 子组件 MyBar <template> <div> <slot name="two" :user1='usname'></slot>// 有名字的插槽 <slot :user='usname'></slot> //无名字插槽 :user 自己命名的属性,'usname'就是data里的值 //通过 阅读全文
posted @ 2021-04-09 17:35 light丶 阅读(6635) 评论(0) 推荐(0)
摘要: 一般不使用具名插槽时,都是这样使用 子组件 MyBar <template> <slot> <button>点我</button> //如果父组件在使用子组件的时没有写入标签或内容就会默认显示button </slot> </template> 父组件 MySideBar <template> <m 阅读全文
posted @ 2021-04-09 17:08 light丶 阅读(2673) 评论(0) 推荐(1)