You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
751 B
41 lines
751 B
7 years ago
|
|
||
7 years ago
|
export default {
|
||
|
name: 'CheckableTag',
|
||
|
model: {
|
||
|
prop: 'checked',
|
||
|
},
|
||
|
props: {
|
||
|
prefixCls: {
|
||
|
default: 'ant-tag',
|
||
|
type: String,
|
||
|
},
|
||
|
checked: Boolean,
|
||
|
},
|
||
|
computed: {
|
||
|
classes () {
|
||
|
const { prefixCls, checked } = this
|
||
|
return {
|
||
|
[`${prefixCls}`]: true,
|
||
|
[`${prefixCls}-checkable`]: true,
|
||
|
[`${prefixCls}-checkable-checked`]: checked,
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
methods: {
|
||
|
handleClick () {
|
||
|
const { checked } = this
|
||
|
this.$emit('input', !checked)
|
||
|
this.$emit('change', !checked)
|
||
|
},
|
||
|
},
|
||
7 years ago
|
render () {
|
||
|
const { classes, handleClick, $slots } = this
|
||
|
return (
|
||
|
<div class={classes} onClick={handleClick}>
|
||
|
{$slots.default}
|
||
|
</div>
|
||
|
)
|
||
|
},
|
||
7 years ago
|
}
|
||
7 years ago
|
|