Commit f3c6cd68d18c5df46170e6975d498f471ba8e0d0

Authored by 梁灏
1 parent 53a6915a

fixed FormItem label slot bug

examples/routers/form.vue
1 <template> 1 <template>
2 <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80"> 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 <Input v-model="formValidate.name" placeholder="请输入姓名"></Input> 5 <Input v-model="formValidate.name" placeholder="请输入姓名"></Input>
5 </Form-item> 6 </Form-item>
6 <Form-item label="邮箱" prop="mail"> 7 <Form-item label="邮箱" prop="mail">
src/components/form/form-item.vue
1 <template> 1 <template>
2 <div :class="classes"> 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 <div :class="[prefixCls + '-content']" :style="contentStyles"> 4 <div :class="[prefixCls + '-content']" :style="contentStyles">
5 <slot></slot> 5 <slot></slot>
6 <transition name="fade"> 6 <transition name="fade">