Commit 737894dee21df6fb16bd5f9729751c58aa560f5b

Authored by 梁灏
1 parent 85468042

ColorPicker support global setting

examples/routers/color-picker.vue
... ... @@ -5,18 +5,15 @@
5 5 <color-picker
6 6 v-model="color"
7 7 placement="bottom-start"
8   - size="large"
9 8 @on-change="c1"
10 9 @on-active-change="c2"></color-picker>
11 10 <Input value="hello" style="display: inline-block" />
12 11 <Date-picker
13   - transfer
14 12 type="date"
15 13 placeholder="选择日期"
16 14 style="width: 200px"></Date-picker>
17 15 <color-picker
18 16 ref="xxx"
19   - :transfer="true"
20 17 v-model="color"
21 18 :recommend="true"
22 19 format="rgb"
... ... @@ -32,17 +29,15 @@
32 29 <color-picker
33 30 v-model="color"
34 31 placement="bottom-start"
35   - size="small"></color-picker>
  32 + ></color-picker>
36 33 <Date-picker
37 34 type="date"
38 35 placeholder="选择日期"
39   - size="small"
40 36 style="width: 200px"></Date-picker>
41 37 <color-picker
42 38 ref="yyy"
43 39 :colors="colors"
44 40 v-model="color"
45   - transfer
46 41 format="rgb"
47 42 alpha></color-picker>
48 43 <Button @click="setColor">set color</Button>
... ... @@ -57,7 +52,6 @@
57 52 v-model="color7"
58 53 :hue="false"
59 54 :hide-drop-down="hideDropDown"
60   - transfer
61 55 @on-open-change="onOpenChange"></ColorPicker>
62 56  
63 57 <br><br><br><br>
... ...
src/components/color-picker/color-picker.vue
... ... @@ -168,11 +168,12 @@ export default {
168 168 default: false,
169 169 },
170 170 size: {
171   - type: String,
172 171 validator(value) {
173 172 return oneOf(value, ['small', 'large', 'default']);
174 173 },
175   - default: 'default',
  174 + default () {
  175 + return this.$IVIEW.size === '' ? 'default' : this.$IVIEW.size;
  176 + }
176 177 },
177 178 hideDropDown: {
178 179 type: Boolean,
... ... @@ -200,7 +201,9 @@ export default {
200 201 },
201 202 transfer: {
202 203 type: Boolean,
203   - default: false,
  204 + default () {
  205 + return this.$IVIEW.transfer === '' ? false : this.$IVIEW.transfer;
  206 + }
204 207 },
205 208 name: {
206 209 type: String,
... ...