当我在普通的html <input>
标签上使用vue表单时,验证工作正常。
当我使用<md-input>
代替验证无效时,我收到以下错误:
未找到v-model的元素
<input>
<vue-form :state="formState" @submit.prevent="onSubmit">
<validate>
<label>Name</label>
<input v-model="model.name" required name="name" />
<field-messages name="name">
<div>Success!</div>
<div slot="required">Name is a required field</div>
</field-messages>
</validate>
<button type="submit">Submit</button>
</vue-form>
不使用<md-input>
<vue-form :state="formState" @submit.prevent="onSubmit">
<validate>
<md-input-container md-inline>
<label>Name</label>
<md-input v-model="model.name" required name="name"></md-input>
</md-input-container>
<field-messages name="name">
<div>Success!</div>
<div slot="required">Name is a required field</div>
</field-messages>
</validate>
<button type="submit">Submit</button>
</vue-form>
答案 0 :(得分:0)
您必须使用md-field和md-input标记。