feat(Form): allow validator to return mesage (#8052)

This commit is contained in:
neverland
2021-01-31 20:17:45 +08:00
committed by GitHub
parent 63227201ff
commit 6d336b5537
6 changed files with 73 additions and 19 deletions
@@ -82,6 +82,22 @@ exports[`should render demo and match snapshot 1`] = `
</div>
</div>
</div>
<div class="van-cell van-field">
<div class="van-cell__title van-field__label">
<span>
Label
</span>
</div>
<div class="van-cell__value van-field__value">
<div class="van-field__body">
<input type="text"
name="validatorMessage"
class="van-field__control"
placeholder="Use validator to return message"
>
</div>
</div>
</div>
<div class="van-cell van-field">
<div class="van-cell__title van-field__label">
<span>
+5 -5
View File
@@ -6,11 +6,11 @@ test('submit method', async () => {
mountForm({
template: `
<van-form ref="form" @submit="onSubmit">
<van-field name="A" value="bar" />
<van-button native-type="submit" />
</van-form>
`,
<van-form ref="form" @submit="onSubmit">
<van-field name="A" value="bar" />
<van-button native-type="submit" />
</van-form>
`,
mounted() {
this.$refs.form.submit();
},