【发布时间】:2019-09-01 14:11:59
【问题描述】:
我有一个在 Laravel 刀片文件中使用 vue 的注册表单。我正在对用户的无效输入使用验证器,并且我想获取该字段的旧值,但现在我无法使其工作,因为某些字段正在使用 vue。这是我的代码:
regist.blade.php
<div class="regist_input">
<input type="email" name="email" v-model="email" v-bind:placeholder="placeholder_email" v-bind:class="{ error: emailError }">
<p class="error_text" v-bind:class="{ active: emailError2 }">Invalid email.</p>
@if($errors->has('email'))
<p class="alert-error">
{{ $errors->first('email') }}
</p>
@endif
</div>
<dd>
<div class="regist_input">
<input class="input_company" type="text" name="company" value="{{ old('company') }}" placeholder="company"> //this one works
</div>
</dd>
控制器
if($validator->fails()) {
return redirect()->back()->withInput()->withErrors($validator->errors());
}
如果在字段之外,我可以显示它的旧值,这意味着我的验证 php 函数正在工作。
我尝试使用v-bind:value="{{ old('email') }}" 或:value="{{ old('email') }}" 但不起作用。对于这个,如何在具有vue组件的输入字段中显示旧值?
【问题讨论】:
标签: php laravel vue.js laravel-blade