mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: migrate cell default slot (#8971)
This commit is contained in:
parent
edb6ea8858
commit
bc8bad0247
@ -96,7 +96,7 @@ export default defineComponent({
|
|||||||
<div class={bem({ disabled })} onClick={onClick}>
|
<div class={bem({ disabled })} onClick={onClick}>
|
||||||
<Cell
|
<Cell
|
||||||
v-slots={{
|
v-slots={{
|
||||||
default: renderContent,
|
value: renderContent,
|
||||||
'right-icon': renderRightIcon,
|
'right-icon': renderRightIcon,
|
||||||
}}
|
}}
|
||||||
border={false}
|
border={false}
|
||||||
|
@ -42,6 +42,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<Cell
|
<Cell
|
||||||
|
v-slots={{ value: renderContent }}
|
||||||
center
|
center
|
||||||
icon={props.type === 'edit' ? 'contact' : 'add-square'}
|
icon={props.type === 'edit' ? 'contact' : 'add-square'}
|
||||||
class={bem([props.type])}
|
class={bem([props.type])}
|
||||||
@ -49,9 +50,7 @@ export default defineComponent({
|
|||||||
isLink={props.editable}
|
isLink={props.editable}
|
||||||
valueClass={bem('value')}
|
valueClass={bem('value')}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
/>
|
||||||
{renderContent()}
|
|
||||||
</Cell>
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ export default defineComponent({
|
|||||||
<Cell
|
<Cell
|
||||||
v-slots={{
|
v-slots={{
|
||||||
icon: renderEditIcon,
|
icon: renderEditIcon,
|
||||||
default: renderContent,
|
value: renderContent,
|
||||||
'right-icon': renderRightIcon,
|
'right-icon': renderRightIcon,
|
||||||
}}
|
}}
|
||||||
key={item.id}
|
key={item.id}
|
||||||
|
@ -134,8 +134,17 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderIcon = () => {
|
||||||
|
if (active) {
|
||||||
|
return (
|
||||||
|
<Icon class={bem('icon')} color={activeColor} name="success" />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Cell
|
<Cell
|
||||||
|
v-slots={{ value: renderIcon }}
|
||||||
clickable
|
clickable
|
||||||
key={option.value}
|
key={option.value}
|
||||||
icon={option.icon}
|
icon={option.icon}
|
||||||
@ -143,11 +152,7 @@ export default defineComponent({
|
|||||||
class={bem('option', { active })}
|
class={bem('option', { active })}
|
||||||
style={{ color: active ? activeColor : '' }}
|
style={{ color: active ? activeColor : '' }}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
></Cell>
|
||||||
{active && (
|
|
||||||
<Icon class={bem('icon')} color={activeColor} name="success" />
|
|
||||||
)}
|
|
||||||
</Cell>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -486,6 +486,23 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderFieldBody = () => [
|
||||||
|
<div class={bem('body')}>
|
||||||
|
{renderInput()}
|
||||||
|
{showClear.value && (
|
||||||
|
<Icon
|
||||||
|
name={props.clearIcon}
|
||||||
|
class={bem('clear')}
|
||||||
|
onTouchstart={onClear}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{renderRightIcon()}
|
||||||
|
{slots.button && <div class={bem('button')}>{slots.button()}</div>}
|
||||||
|
</div>,
|
||||||
|
renderWordLimit(),
|
||||||
|
renderMessage(),
|
||||||
|
];
|
||||||
|
|
||||||
useExpose({
|
useExpose({
|
||||||
blur,
|
blur,
|
||||||
focus,
|
focus,
|
||||||
@ -526,6 +543,7 @@ export default defineComponent({
|
|||||||
v-slots={{
|
v-slots={{
|
||||||
icon: LeftIcon ? () => LeftIcon : null,
|
icon: LeftIcon ? () => LeftIcon : null,
|
||||||
title: Label ? () => Label : null,
|
title: Label ? () => Label : null,
|
||||||
|
value: renderFieldBody,
|
||||||
extra: slots.extra,
|
extra: slots.extra,
|
||||||
}}
|
}}
|
||||||
size={props.size}
|
size={props.size}
|
||||||
@ -545,22 +563,7 @@ export default defineComponent({
|
|||||||
valueClass={bem('value')}
|
valueClass={bem('value')}
|
||||||
titleClass={[bem('label', labelAlign), props.labelClass]}
|
titleClass={[bem('label', labelAlign), props.labelClass]}
|
||||||
arrowDirection={props.arrowDirection}
|
arrowDirection={props.arrowDirection}
|
||||||
>
|
/>
|
||||||
<div class={bem('body')}>
|
|
||||||
{renderInput()}
|
|
||||||
{showClear.value && (
|
|
||||||
<Icon
|
|
||||||
name={props.clearIcon}
|
|
||||||
class={bem('clear')}
|
|
||||||
onTouchstart={onClear}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{renderRightIcon()}
|
|
||||||
{slots.button && <div class={bem('button')}>{slots.button()}</div>}
|
|
||||||
</div>
|
|
||||||
{renderWordLimit()}
|
|
||||||
{renderMessage()}
|
|
||||||
</Cell>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user