是否可以在vue.js中获取json响应而不将其传递给视图刀片?

时间:2017-11-29 22:09:03

标签: javascript laravel vue.js

我的配置文件控制器中有方法可以检索用户详细信息。

路线如下:

Route::get('show-profile/{slug}', 'ProfileController@show')-
>name('profile.show')->where('username', '[\w\d\-\_]+');

,方法是:

public function show($slug)
{
    $profile = User::where('username', $slug)->first();
    return response()->json([
       'profile' => $profile,
        'title'  => 'My Profile'
    ]);
    // return view('dashboard.profile-show', ['profile' => $profile, 'title' => 'My Profile',]);
}

我的挑战是我不想将它传递给视图刀片,相反,我想使用vue.js并获得json响应。

感谢您的帮助。

0 个答案:

没有答案