checkbox component

This commit is contained in:
cookfront 2017-03-01 11:17:21 +08:00
parent e0be5b962e
commit c2a46edeae
3 changed files with 15 additions and 1 deletions

View File

@ -12,6 +12,11 @@
<zan-checkbox-group v-model="result"> <zan-checkbox-group v-model="result">
<zan-checkbox v-for="item in list" :name="item">复选框{{item}}</zan-checkbox> <zan-checkbox v-for="item in list" :name="item">复选框{{item}}</zan-checkbox>
</zan-checkbox-group> </zan-checkbox-group>
<h2 class="page-sub-title">禁用Checkbox组</h2>
<zan-checkbox-group v-model="result" disabled>
<zan-checkbox v-for="item in list" :name="item">复选框{{item}}</zan-checkbox>
</zan-checkbox-group>
</div> </div>
</template> </template>
@ -26,7 +31,7 @@ export default {
'b', 'b',
'c' 'c'
], ],
result: [] result: ['a', 'b']
}; };
}, },

View File

@ -17,6 +17,12 @@
<zan-radio name="2">单选框2</zan-radio> <zan-radio name="2">单选框2</zan-radio>
</zan-radio-group> </zan-radio-group>
<h2 class="page-sub-title">禁用radio组</h2>
<zan-radio-group v-model="radio3" disabled>
<zan-radio name="1">单选框1</zan-radio>
<zan-radio name="2">单选框2</zan-radio>
</zan-radio-group>
<h2 class="page-sub-title">与Cell组件一起使用</h2> <h2 class="page-sub-title">与Cell组件一起使用</h2>
</div> </div>

View File

@ -67,6 +67,9 @@ export default {
} }
}, },
/**
* `checkbox`是否被选中
*/
isChecked() { isChecked() {
if ({}.toString.call(this.currentValue) === '[object Boolean]') { if ({}.toString.call(this.currentValue) === '[object Boolean]') {
return this.currentValue; return this.currentValue;