javascript - 如何设置使用 v-model 的值输入?- 拉拉维尔
问题描述
如何设置使用 v-model 的值输入?我用谷歌搜索了这个问题,但没有解决我有这样的输入:
<input type="text" name="customer_email" v-model="form.customer_email" id="email">
我需要将此输入值设置为{{ auth()->user()->email }}
解决方案
试试这个 :)
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');
推荐阅读
- arrays - 使用 C 从文件中读取整数以将其添加到数组中。但是当我尝试打印数组时,我会打印地址
- python - 如何更具体地绘制 seaborn 线图
- java - Java Regex 多分隔符按顺序拆分
- c# - 从 xml c# 获取数据
- r - 在R中找到两个掷骰子的最小值
- reactjs - React useReducer:状态未更新
- java - 如何将通知从一个安卓应用程序发送到另一个安卓应用程序?
- replace - 如何使用 RDKit 用另一个原子替换氢原子?
- android - 包含 Composite Disposable 的 Android 单元测试方法
- python - 使用正则表达式从行为模式中获取数值