diff --git a/examples/routers/form.vue b/examples/routers/form.vue index 3eeb355..810bcda 100644 --- a/examples/routers/form.vue +++ b/examples/routers/form.vue @@ -1,6 +1,7 @@ <template> <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80"> - <Form-item label="姓名" prop="name"> + <Form-item prop="name"> + <span slot="label"><Icon type="ionic"></Icon></span> <Input v-model="formValidate.name" placeholder="请输入姓名"></Input> </Form-item> <Form-item label="邮箱" prop="mail"> diff --git a/src/components/form/form-item.vue b/src/components/form/form-item.vue index 503ca31..265d270 100644 --- a/src/components/form/form-item.vue +++ b/src/components/form/form-item.vue @@ -1,6 +1,6 @@ <template> <div :class="classes"> - <label :class="[prefixCls + '-label']" :style="labelStyles" v-if="label"><slot name="label">{{ label }}</slot></label> + <label :class="[prefixCls + '-label']" :style="labelStyles" v-if="label || $slots.label"><slot name="label">{{ label }}</slot></label> <div :class="[prefixCls + '-content']" :style="contentStyles"> <slot></slot> <transition name="fade"> -- libgit2 0.21.4