[improvement] Tag and Uploader: jsx (#2627)

This commit is contained in:
张敏
2019-01-27 08:21:18 +08:00
committed by neverland
parent fab090bef9
commit 874d2f79ca
3 changed files with 54 additions and 44 deletions
@@ -1,32 +1,15 @@
<template>
<span
:class="[b({
mark,
plain,
round,
[size]: size
}), {
'van-hairline--surround': plain
}]"
:style="style"
>
<slot />
</span>
</template>
<script>
import create from '../utils/create';
import { use } from '../utils';
import { RED, BLUE, GREEN, GRAY_DARK } from '../utils/color';
const [sfc, bem] = use('tag');
const COLOR_MAP = {
danger: RED,
primary: BLUE,
success: GREEN
};
export default create({
name: 'tag',
export default sfc({
props: {
size: String,
type: String,
@@ -49,6 +32,28 @@ export default create({
return style;
}
},
render(h) {
const {
mark,
plain,
round,
size
} = this;
return (
<span
class={[
bem({ mark, plain, round, [size]: size }),
{
'van-hairline--surround': plain
}
]}
style={this.style}
>
{this.$slots.default}
</span>
);
}
});
</script>