vue router to from All In One
vue router to from All In One
vue watch $route
// eslint-disable-next-line no-new
new Vue({
router,
store,
render: h => h(App),
watch: {
$route (to, from) {
// const {
// name,
// // id,
// } = UtilCache.getLocalItem('userInfo');
console.log('to.path', to, to.path);
// ...
}
}
}).$mount('#app');
next(to) bug ❌
router.beforeEach((to, from, next) => {
// ._t 时间戳 ?
// console.log('to.query._t', to.query._t);
if (typeof to.query._t !== 'undefined') {
next();
} else {
to.query._t = parseInt(new Date().getTime() / 1000);
// bug
next(to);
}
});
https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route
vue components watch $route ???
https://router.vuejs.org/api/#to
https://router.vuejs.org/api/#the-route-object
refs
https://flaviocopes.com/vue-router/
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14551785.html
未经授权禁止转载,违者必究!