30 lines
500 B
JavaScript
30 lines
500 B
JavaScript
export default `<template>
|
|
<div style="cursor: pointer">
|
|
<el-tag :type="type" @click.native="handleClick">{{ text }}</el-tag>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
value: {
|
|
type: Boolean,
|
|
required: true
|
|
}
|
|
},
|
|
computed: {
|
|
type () {
|
|
return this.value ? 'success' : 'danger'
|
|
},
|
|
text () {
|
|
return this.value ? '是' : '否'
|
|
}
|
|
},
|
|
methods: {
|
|
handleClick () {
|
|
this.$emit('input', !this.value)
|
|
}
|
|
}
|
|
}
|
|
</script>`
|