mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
fix(Field): should not render empty label
This commit is contained in:
@@ -19,7 +19,8 @@ export default createComponent({
|
||||
setup(props, { slots, emit }) {
|
||||
return function () {
|
||||
const { icon, size, title, label, value, isLink } = props;
|
||||
const showTitle = slots.title || isDef(title);
|
||||
const titleSlot = slots.title?.();
|
||||
const showTitle = titleSlot || isDef(title);
|
||||
|
||||
function Label() {
|
||||
const showLabel = slots.label || isDef(label);
|
||||
@@ -40,7 +41,7 @@ export default createComponent({
|
||||
class={[bem('title'), props.titleClass]}
|
||||
style={props.titleStyle}
|
||||
>
|
||||
{slots.title ? slots.title() : <span>{title}</span>}
|
||||
{slots.title ? titleSlot : <span>{title}</span>}
|
||||
{Label()}
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user