feat(Field): add extra slot (#6290)

* feat(Field): add extra slot

* docs: remove form demo style
This commit is contained in:
neverland
2020-05-16 11:18:08 +08:00
committed by GitHub
parent 5c8d1d2420
commit 6870bdcbc2
11 changed files with 124 additions and 119 deletions
@@ -79,6 +79,14 @@ exports[`reach max word-limit 1`] = `
</div>
`;
exports[`render extra slot 1`] = `
<div class="van-cell van-field">
<div class="van-cell__value van-cell__value--alone van-field__value">
<div class="van-field__body"><input type="text" class="van-field__control"></div>
</div>Extra
</div>
`;
exports[`render input slot 1`] = `
<div class="van-cell van-field">
<div class="van-cell__value van-cell__value--alone van-field__value">
+16 -16
View File
@@ -203,14 +203,9 @@ test('clearable', () => {
});
test('render input slot', () => {
const wrapper = mount({
template: `
<field>
<template v-slot:input>Custom Input</template>
</field>
`,
components: {
Field,
const wrapper = mount(Field, {
scopedSlots: {
input: () => 'Custom Input',
},
});
@@ -218,14 +213,19 @@ test('render input slot', () => {
});
test('render label slot', () => {
const wrapper = mount({
template: `
<field label="Default Label">
<template v-slot:label>Custom Label</template>
</field>
`,
components: {
Field,
const wrapper = mount(Field, {
scopedSlots: {
label: () => 'Custom Label',
},
});
expect(wrapper).toMatchSnapshot();
});
test('render extra slot', () => {
const wrapper = mount(Field, {
scopedSlots: {
extra: () => 'Extra',
},
});