Commit f3c6cd68d18c5df46170e6975d498f471ba8e0d0
1 parent
53a6915a
fixed FormItem label slot bug
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
examples/routers/form.vue
1 | 1 | <template> |
2 | 2 | <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80"> |
3 | - <Form-item label="姓名" prop="name"> | |
3 | + <Form-item prop="name"> | |
4 | + <span slot="label"><Icon type="ionic"></Icon></span> | |
4 | 5 | <Input v-model="formValidate.name" placeholder="请输入姓名"></Input> |
5 | 6 | </Form-item> |
6 | 7 | <Form-item label="邮箱" prop="mail"> | ... | ... |
src/components/form/form-item.vue
1 | 1 | <template> |
2 | 2 | <div :class="classes"> |
3 | - <label :class="[prefixCls + '-label']" :style="labelStyles" v-if="label"><slot name="label">{{ label }}</slot></label> | |
3 | + <label :class="[prefixCls + '-label']" :style="labelStyles" v-if="label || $slots.label"><slot name="label">{{ label }}</slot></label> | |
4 | 4 | <div :class="[prefixCls + '-content']" :style="contentStyles"> |
5 | 5 | <slot></slot> |
6 | 6 | <transition name="fade"> | ... | ... |