Alex_TD

2020年3月15日

vuex状态管理 ---store

摘要: export default new Vue.Store({ state: { count:0, }, mutations: { }, actions: { }, modules:{ } })import {mapStates,mapMutations,mapActions} from 'vuex' 阅读全文

posted @ 2020-03-15 20:29 Alex_TD 阅读(96) 评论(0) 推荐(0) 编辑
vue-router

摘要: 还有个命名视图:router-view 可以加别名name=xxx 路由组件要有相应的组件components:{default: xxx,a:xxxx} $router.options.routes 获取router类的属性 信息; $route.path 获取请求路径相关信息 如:path 和 阅读全文

posted @ 2020-03-15 16:29 Alex_TD 阅读(136) 评论(0) 推荐(0) 编辑
Vue 多层组件传值(最外层组件>中间组件>最内部组件)

摘要: 多层组件传值:(传递属性,传递方法) 1.由最外往最内传值: 最外组件绑定属性:a='5',中间组件绑定v-on='$attrs' 最内组件 this.$attrs获取a=5; 2.由最内往最外传值:通过事件监听: 最内发射事件:this.$emit('b','China'), 中间组件绑定v-on 阅读全文

posted @ 2020-03-15 13:00 Alex_TD 阅读(4636) 评论(0) 推荐(0) 编辑