问题解决了,在webpack.min.js加上
mix.webpackConfig({
output: {
publicPath: '/'
}
});
使用vue-router 懒加载 ,初次渲染页面成功,当访问其他组建时 会向后端发送一个请求
比如 http://127.0.0.1:8000/tables/1.js ,该请求被laravel 路由劫持 渲染了页面,该怎样解决
// laravel wep.php
Route::get('/{all?}', function () {
return view('backend');
})->where(['all' => '.*?']);
找到问题了 因为调试的时候我是刷新页面看的结果,请求是异步的,导致还没有赋值 控制台就输出结果了 感谢
const router = new VueRouter({
mode:'history',
routes
});
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) {
console.log(Store.state.AuthUser);
/*
* 此时 AuthUser.authenticated 为true
* {__ob__: Observer}
authenticated:true
email:"12345@qq.com"
name:"12345"
*
* */
console.log(Store.state.AuthUser.authenticated);
/*
此时 AuthUser.authenticated 为false
*/
if (Store.state.AuthUser.authenticated || JWTToken.getToken()) {
return next();
} else {
return next({ name : 'confirm' });
}
}
if (to.meta.requiresGuest) {
if (Store.state.authenticated || JWTToken.getToken()) {
return next({ name : 'home' });
} else {
return next();
}
}
next();
});
export default router;
Store.state.AuthUser 有值
Store.state.AuthUser.authenticated 始终为false 不知道是什么原因 @JellyBool 有遇到这个问题吗?
多点编辑的快捷键时什么
按你的方法修改后 已解决 膜拜大神
评论后 提示这个错误
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "count"
我粘贴的内容 为什么会丢掉一部分
发布评论后 提示这个错误 时什么问题?
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "count"
found in
---> <Comments> at /Users/shiwuhao/Documents/code/myCode/zhihu/resources/assets/js/components/Comments.vue
<Root>
发布评论后 提示这个错误 时什么问题?
found in
---> <Comments> at /Users/shiwuhao/Documents/code/myCode/zhihu/resources/assets/js/components/Comments.vue
<Root>