init
init
This commit is contained in:
parent
5762337416
commit
7fa943eb39
128 changed files with 51042 additions and 1 deletions
2
components/tag/index.js
Normal file
2
components/tag/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
import Tag from './tag.vue';
|
||||
export default Tag;
|
51
components/tag/tag.vue
Normal file
51
components/tag/tag.vue
Normal file
|
@ -0,0 +1,51 @@
|
|||
<template>
|
||||
<div v-if="!closed" :class="classes" transition="fade">
|
||||
<span :class="textClasses"><slot></slot></span>
|
||||
<Icon v-if="closable" type="ios-close-empty" @click="close"></Icon>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Icon from '../icon';
|
||||
import { oneOf } from '../../utils/assist';
|
||||
|
||||
const prefixCls = 'ivu-tag';
|
||||
|
||||
export default {
|
||||
components: { Icon },
|
||||
props: {
|
||||
closable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
color: {
|
||||
validator (value) {
|
||||
return oneOf(value, ['blue', 'green', 'red', 'yellow']);
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
closed: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
classes () {
|
||||
return [
|
||||
`${prefixCls}`,
|
||||
{
|
||||
[`${prefixCls}-${this.color}`]: !!this.color
|
||||
}
|
||||
]
|
||||
},
|
||||
textClasses () {
|
||||
return `${prefixCls}-text`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close (e) {
|
||||
this.closed = true;
|
||||
this.$emit('on-close', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue