[improvement] Tag: add color prop (#1946)

This commit is contained in:
neverland
2018-10-17 14:37:27 +08:00
committed by GitHub
parent 995ae8c300
commit abbde67325
5 changed files with 51 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
}), {
'van-hairline--surround': plain
}]"
:style="style"
>
<slot />
</span>
@@ -17,10 +18,23 @@ import create from '../utils/create';
export default create({
name: 'tag',
props: {
type: String,
mark: Boolean,
color: String,
plain: Boolean
},
computed: {
style() {
if (this.color) {
const key = this.plain ? 'color' : 'backgroundColor';
return {
[key]: this.color
};
}
}
}
});
</script>