feat(Tag): add show prop and fix transition

This commit is contained in:
chenjiahan
2020-07-25 16:12:12 +08:00
parent 73d538be05
commit 7317a1379b
4 changed files with 21 additions and 19 deletions
+13 -13
View File
@@ -1,7 +1,5 @@
// Utils
import { Transition } from 'vue';
import { createNamespace } from '../utils';
// Components
import Icon from '../icon';
const [createComponent, bem] = createNamespace('tag');
@@ -19,6 +17,10 @@ export default createComponent({
type: String,
default: 'default',
},
show: {
type: Boolean,
default: true,
},
},
emits: ['close'],
@@ -51,16 +53,14 @@ export default createComponent({
);
return (
<transition name={props.closeable ? 'van-fade' : null}>
<span
key="content"
style={style}
class={bem([classes, type])}
>
{slots.default?.()}
{CloseIcon}
</span>
</transition>
<Transition name={props.closeable ? 'van-fade' : null}>
{props.show ? (
<span key="content" style={style} class={bem([classes, type])}>
{slots.default?.()}
{CloseIcon}
</span>
) : null}
</Transition>
);
};
},