fix(components): [form] label-position props default value (#7838)

This commit is contained in:
류한경 2022-05-24 15:01:52 +09:00 committed by GitHub
parent 769148b780
commit 4ae21b0632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -210,6 +210,14 @@ describe('Form', () => {
<Input v-model={form.address} /> <Input v-model={form.address} />
</FormItem> </FormItem>
</Form> </Form>
<Form model={form} ref="labelRight">
<FormItem>
<Input v-model={form.name} />
</FormItem>
<FormItem>
<Input v-model={form.address} />
</FormItem>
</Form>
</div> </div>
) )
}, },
@ -220,6 +228,9 @@ describe('Form', () => {
expect(wrapper.findComponent({ ref: 'labelLeft' }).classes()).toContain( expect(wrapper.findComponent({ ref: 'labelLeft' }).classes()).toContain(
'el-form--label-left' 'el-form--label-left'
) )
expect(wrapper.findComponent({ ref: 'labelRight' }).classes()).toContain(
'el-form--label-right'
)
}) })
it('label size', () => { it('label size', () => {

View File

@ -16,7 +16,11 @@ export const formProps = buildProps({
rules: { rules: {
type: definePropType<FormRules>(Object), type: definePropType<FormRules>(Object),
}, },
labelPosition: String, labelPosition: {
type: String,
values: ['left', 'right', 'top'] as const,
default: 'right',
},
labelWidth: { labelWidth: {
type: [String, Number], type: [String, Number],
default: '', default: '',