Form add prop label-colon

This commit is contained in:
梁灏 2019-09-16 10:47:54 +08:00
parent 66e8d1cb7b
commit cd4b085967
2 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<div :class="classes"> <div :class="classes">
<label :class="[prefixCls + '-label']" :for="labelFor" :style="labelStyles" v-if="label || $slots.label"><slot name="label">{{ label }}</slot></label> <label :class="[prefixCls + '-label']" :for="labelFor" :style="labelStyles" v-if="label || $slots.label"><slot name="label">{{ label }}{{ form.colon }}</slot></label>
<div :class="[prefixCls + '-content']" :style="contentStyles"> <div :class="[prefixCls + '-content']" :style="contentStyles">
<slot></slot> <slot></slot>
<transition name="fade"> <transition name="fade">

View file

@ -42,6 +42,11 @@
hideRequiredMark: { hideRequiredMark: {
type: Boolean, type: Boolean,
default: false default: false
},
// 4.0.0
labelColon: {
type: [Boolean, String],
default: false
} }
}, },
provide() { provide() {
@ -62,6 +67,13 @@
[`${prefixCls}-hide-required-mark`]: this.hideRequiredMark [`${prefixCls}-hide-required-mark`]: this.hideRequiredMark
} }
]; ];
},
colon () {
let colon = '';
if (this.labelColon) {
colon = (typeof this.labelColon === 'boolean') ? ':' : this.labelColon;
}
return colon;
} }
}, },
methods: { methods: {