摘要: export default new Router({ mode: 'history', //路由模式,取值为history与hash base: '/', //打包路径,默认为/,可以修改 routes: [ { path: string, //路径 component: Component; / 阅读全文
posted @ 2020-04-02 19:22 只争朝夕,不负韶华 阅读(5096) 评论(0) 推荐(0)
摘要: 在main.j中使用全局前置守卫 router.beforeEach来检测路由 import router from './router' //.... router.beforeEach((to, from, next) => { if (to.matched.length 0) { next(' 阅读全文
posted @ 2020-04-02 16:54 只争朝夕,不负韶华 阅读(349) 评论(0) 推荐(0)
摘要: 1. 对于creaetd,mounted 等生命周期函数 mixin中的代码先执行,单文件中的后执行。 // page.vue文件 <template> <div id="app"> <div id="nav"> <button @click="comFun">page和mixin中相同事件执行</ 阅读全文
posted @ 2020-04-02 15:43 只争朝夕,不负韶华 阅读(5515) 评论(1) 推荐(0)
摘要: 加载渲染过程 父beforeCreate->父created->父beforeMount->子beforeCreate->子created->子beforeMount->子mounted->父mounted 子组件更新过程 父beforeUpdate->子beforeUpdate->子updated 阅读全文
posted @ 2020-04-02 02:48 只争朝夕,不负韶华 阅读(261) 评论(0) 推荐(0)