Files
mes-ui-d2/src/views/demo/d2-crud/demo26/codeComponent.js

30 lines
500 B
JavaScript
Raw Normal View History

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>`