checkbox component

This commit is contained in:
cookfront
2017-03-01 11:31:52 +08:00
parent c2a46edeae
commit d4950678e6
5 changed files with 181 additions and 14 deletions

View File

@@ -37,10 +37,16 @@ export default {
},
computed: {
/**
* `checkbox`是否在`zan-checkbox-group`中
*/
isGroup() {
return !!this.findParentByComponentName('zan-checkbox-group');
},
/**
* `checkbox`当前值
*/
currentValue: {
get() {
return this.isGroup && this.parentGroup ? this.parentGroup.value.indexOf(this.name) !== -1 : this.value;
@@ -78,6 +84,9 @@ export default {
}
},
/**
* `checkbox`是否被禁用
*/
isDisabled() {
return this.isGroup && this.parentGroup
? this.parentGroup.disabled || this.disabled