mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +08:00
chore(Tag): code review
This commit is contained in:
parent
1c020a9dac
commit
da0d5435de
@ -1,4 +1,4 @@
|
|||||||
import { computed, Transition } from 'vue';
|
import { Transition } from 'vue';
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
@ -31,16 +31,17 @@ export default createComponent({
|
|||||||
emit('close');
|
emit('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
const style = computed(() => {
|
const getStyle = () => {
|
||||||
const key = props.plain ? 'color' : 'backgroundColor';
|
if (props.plain) {
|
||||||
const style = { [key]: props.color };
|
return {
|
||||||
|
color: props.textColor || props.color,
|
||||||
if (props.textColor) {
|
};
|
||||||
style.color = props.textColor;
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
return style;
|
color: props.textColor,
|
||||||
});
|
background: props.color,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const { show, type, mark, plain, round, size, closeable } = props;
|
const { show, type, mark, plain, round, size, closeable } = props;
|
||||||
@ -55,13 +56,13 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition name={closeable ? 'van-fade' : null}>
|
<Transition name={closeable ? 'van-fade' : undefined}>
|
||||||
{show && (
|
{show ? (
|
||||||
<span style={style.value} class={bem([classes, type])}>
|
<span style={getStyle()} class={bem([classes, type])}>
|
||||||
{slots.default?.()}
|
{slots.default?.()}
|
||||||
{CloseIcon}
|
{CloseIcon}
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
</Transition>
|
</Transition>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user