2 回答

TA贡献1827条经验 获得超9个赞
尝试这个 :)
data() {
return {
form: {
customer_email: "",
}
}
},methods:{
user(){
axios.get("api/profile").then(({data})=>{
(this.user = data)
this.form.customer_emeail = this.user.email
})
},
},created(){
this.user();
}
在你的控制器中添加这个
public function profile()
{
return auth('api')->user();
}
然后把它放在你的 api.php 中
Route::get('profile','YourController@profile');

TA贡献1820条经验 获得超9个赞
当你使用双向数据绑定时v-model,你可以简单地在 vue 端设置这个值。
let app = new Vue({
el:"#app",
data() {
return {
form: {
customer_email: "{{ auth()->user()->email }}",
......
......
}
}
},
......
......
});
添加回答
举报