cherry728
cherry728
1. 全局: beforeEach((to, from, next) => {调用next来resolve这个钩子} ), beforeResolve((to, from, next) => {} ), afterEach((to, from) => {} ) 2. 路由独享: beforeEnter((to, from, next) => {} ), 3. 组件内部: beforeRouteEnter((to,...
action是异步的更改state,本质是dispatch一个action,在action里面其实也是commit一个mutation的。mutation里面是直接对state进行更改
1. Vue.prototype.xxx 2. Vue.mixin,在某个钩子函数里面可以拿到vue实例
v-model其实是语法糖,实现了给表单元素绑定value和相应的事件。源码里面对v-model编译后,实质上在实例的on属性上添加了回调函数,最后都是执行addEventListener。