添加自定义组件示例
Former-commit-id: eb890f1e76db02d8b8613650a4620e0815a2adaa [formerly eb890f1e76db02d8b8613650a4620e0815a2adaa [formerly eb890f1e76db02d8b8613650a4620e0815a2adaa [formerly eb890f1e76db02d8b8613650a4620e0815a2adaa [formerly 6c3a4338de7e3fd586a512bc3ed01607a6d35059 [formerly 82b81ed3a29d38520c9604670dc7215f1d5b5174]]]]] Former-commit-id: 4ea2f665b597d7be5475fcc52f72d5480b861f96 Former-commit-id: 6f021dbf6acf5a37c75de9136f988bc3a145478d Former-commit-id: 73529e2785ecda05d6975294c252f1491484f8fd [formerly bec7cf3aef63adf5fb24202468f6e860d91c2eea] Former-commit-id: f3300f293d8c3179a3261dc198f1ac84bacfcd82 Former-commit-id: 12bb9bc4d7512f3a5b58c8c94148b514b54885e9 Former-commit-id: 23a27dc9331d432f00f415b1fde86f80a11c60a4 Former-commit-id: 3ce60f0a0c26979cefb334119093c0d984c2459d Former-commit-id: feb82325b2b2fd15d9a0ba9df800b800bb3da0b2
This commit is contained in:
29
src/pages/demo/d2-crud/demo25/codeComponent.js
Normal file
29
src/pages/demo/d2-crud/demo25/codeComponent.js
Normal file
@@ -0,0 +1,29 @@
|
||||
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,
|
||||
require: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
type () {
|
||||
return this.value ? 'success' : 'danger'
|
||||
},
|
||||
text () {
|
||||
return this.value ? '是' : '否'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick () {
|
||||
this.$emit('input', !this.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>`
|
||||
Reference in New Issue
Block a user