mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 10:20:19 +08:00
chore: adjust code
This commit is contained in:
parent
82ac453910
commit
3c415c42d0
@ -86,7 +86,7 @@ export default createComponent({
|
|||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
emit('select', item, index);
|
emit('select', item, index);
|
||||||
if (props.closeOnClickAction) {
|
if (props.closeOnClickAction) {
|
||||||
emit('update:show', false);
|
onUpdateShow(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ export default createComponent({
|
|||||||
emits: ['click'],
|
emits: ['click'],
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
function onClick(event) {
|
const onClick = (event) => {
|
||||||
if (props.editable) {
|
if (props.editable) {
|
||||||
emit('click', event);
|
emit('click', event);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function Content() {
|
const renderContent = () => {
|
||||||
if (props.type === 'add') {
|
if (props.type === 'add') {
|
||||||
return props.addText || t('addText');
|
return props.addText || t('addText');
|
||||||
}
|
}
|
||||||
@ -36,19 +36,19 @@ export default createComponent({
|
|||||||
<div>{`${t('name')}:${props.name}`}</div>,
|
<div>{`${t('name')}:${props.name}`}</div>,
|
||||||
<div>{`${t('tel')}:${props.tel}`}</div>,
|
<div>{`${t('tel')}:${props.tel}`}</div>,
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<Cell
|
<Cell
|
||||||
center
|
center
|
||||||
|
icon={props.type === 'edit' ? 'contact' : 'add-square'}
|
||||||
|
class={bem([props.type])}
|
||||||
border={false}
|
border={false}
|
||||||
isLink={props.editable}
|
isLink={props.editable}
|
||||||
class={bem([props.type])}
|
|
||||||
valueClass={bem('value')}
|
valueClass={bem('value')}
|
||||||
icon={props.type === 'edit' ? 'contact' : 'add-square'}
|
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{Content()}
|
{renderContent()}
|
||||||
</Cell>
|
</Cell>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -107,7 +107,7 @@ export default createComponent({
|
|||||||
const text = slots.error ? slots.error() : props.errorText;
|
const text = slots.error ? slots.error() : props.errorText;
|
||||||
if (text) {
|
if (text) {
|
||||||
return (
|
return (
|
||||||
<div onClick={clickErrorText} class={bem('error-text')}>
|
<div class={bem('error-text')} onClick={clickErrorText}>
|
||||||
{text}
|
{text}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -27,6 +27,11 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
|
const spinnerStyle = computed(() => ({
|
||||||
|
color: props.color,
|
||||||
|
...getSizeStyle(props.size),
|
||||||
|
}));
|
||||||
|
|
||||||
const renderText = () => {
|
const renderText = () => {
|
||||||
if (slots.default) {
|
if (slots.default) {
|
||||||
return (
|
return (
|
||||||
@ -42,11 +47,6 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const spinnerStyle = computed(() => ({
|
|
||||||
color: props.color,
|
|
||||||
...getSizeStyle(props.size),
|
|
||||||
}));
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const { type, vertical } = props;
|
const { type, vertical } = props;
|
||||||
return (
|
return (
|
||||||
|
@ -151,12 +151,12 @@ export default createComponent({
|
|||||||
const renderButton = () => (
|
const renderButton = () => (
|
||||||
<div
|
<div
|
||||||
role="slider"
|
role="slider"
|
||||||
|
class={bem('button-wrapper')}
|
||||||
tabindex={props.disabled ? -1 : 0}
|
tabindex={props.disabled ? -1 : 0}
|
||||||
aria-valuemin={props.min}
|
aria-valuemin={props.min}
|
||||||
aria-valuenow={props.modelValue}
|
aria-valuenow={props.modelValue}
|
||||||
aria-valuemax={props.max}
|
aria-valuemax={props.max}
|
||||||
aria-orientation={props.vertical ? 'vertical' : 'horizontal'}
|
aria-orientation={props.vertical ? 'vertical' : 'horizontal'}
|
||||||
class={bem('button-wrapper')}
|
|
||||||
onTouchstart={onTouchStart}
|
onTouchstart={onTouchStart}
|
||||||
onTouchmove={onTouchMove}
|
onTouchmove={onTouchMove}
|
||||||
onTouchend={onTouchEnd}
|
onTouchend={onTouchEnd}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user