Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

javascript - 使用Vue路由器时Laravel路由不起作用(Laravel routes not working when using Vue Router)

I am trying to call a laravel route Route::get('/logout', 'Auth\LoginController@logout');(我正在尝试调用一条laravel路由Route::get('/logout', 'Auth\LoginController@logout');)

that will logout the user and redirect to the login page, but when I try to redirect to this url it won't work, anything happens, just like it was calling a vue router route, but this route does not exists in my router.js .(这将注销用户并重定向到登录页面,但是当我尝试重定向到该URL时,它将无法正常工作,就像调用vue路由器路由一样,但是此路由在我的router.js中不存在router.js 。) This is my route configuration to vue routes:(这是我到vue路由的路由配置:) Route::get('/{vue_capture?}', function () { return view('index'); })->where('vue_capture', '^(?!storage).*$'); and this is my router.js :(这是我的router.js :) //import ... Vue.use(Router) export default new Router({ mode: 'history', routes: [{ path: '/', component: Inicio }, { path: '/viagens/cadastrar', component: Cadastrar }, { path: '/viagens/listar', component: Listar }] }) There's not a /logout route in my route.js , so why it is not calling my laravel route??(我的route.js没有/logout路由,那么为什么它不调用我的laravel路由呢?)   ask by Fantasmic translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

尝试将您的Vue路线放在此行之前:

Auth::routes();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...