摘要: 1:如果调用子组件的时候,只传递一个内容,可以不用solt属性,相当于默认 <child-component> <div> //看这里 我是一类人, 我是默认的插槽 </div> </child-component> Vue.component('child-component',{ templat 阅读全文
posted @ 2019-11-15 22:54 初心不负 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 1:使用withRouter()高阶函数 withRouter()高阶函数将注入 history 对象作为组件的 prop。该对象提供了push()和replace()方法,以避免使用上下文 import { withRouter } from 'react-router-dom' // this 阅读全文
posted @ 2019-11-15 12:50 初心不负 阅读(835) 评论(0) 推荐(0) 编辑