From 7c2ed52c61fa7f1d75ba3bf7e4cefd1f87366b37 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Wed, 15 Mar 2017 18:52:33 +0800 Subject: [PATCH] update Checkbox --- examples/routers/form.vue | 35 +++++++++++++++++++++++++++++++++++ src/components/checkbox/checkbox.vue | 6 +++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/examples/routers/form.vue b/examples/routers/form.vue index 03500af..61a9565 100644 --- a/examples/routers/form.vue +++ b/examples/routers/form.vue @@ -12,6 +12,13 @@ + + + 登录 @@ -22,6 +29,8 @@ data () { return { formInline: { + data1: this.getMockData(), + targetKeys1: this.getTargetKeys(), date: new Date(), user: '', value2: [], @@ -118,6 +127,32 @@ }, handleInput (val) { console.log(val) + }, + getMockData () { + let mockData = []; + for (let i = 1; i <= 20; i++) { + mockData.push({ + key: i.toString(), + label: '内容' + i, + description: '内容' + i + '的描述信息', + disabled: Math.random() * 3 < 1 + }); + } + return mockData; + }, + getTargetKeys () { + return this.getMockData() + .filter(() => Math.random() * 2 > 1) + .map(item => item.key); + }, + render1 (item) { + return item.label; + }, + handleChange1 (newTargetKeys, direction, moveKeys) { + console.log(newTargetKeys); + console.log(direction); + console.log(moveKeys); + this.formInline.targetKeys1 = newTargetKeys; } } } diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index 1b17552..0d76d86 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -18,7 +18,7 @@ :checked="currentValue" @change="change"> - {{ label }} + {{ label }}