kui-vue 3.2.4 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_tool/utils.js +2 -2
- package/components/alert/styles/index.less +19 -19
- package/components/avatar/styles/index.less +3 -3
- package/components/backtop/styles/index.less +2 -2
- package/components/badge/demo/dot.md +1 -1
- package/components/badge/demo/dynamic.md +1 -1
- package/components/badge/demo/max.md +1 -1
- package/components/badge/styles/index.less +21 -21
- package/components/base/input.jsx +16 -10
- package/components/breadcrumb/styles/index.less +4 -4
- package/components/button/button.jsx +14 -8
- package/components/button/buttonGroup.jsx +6 -6
- package/components/button/demo/base.md +2 -1
- package/components/button/demo/disabled.md +14 -16
- package/components/button/demo/group.md +2 -2
- package/components/button/demo/index.vue +6 -2
- package/components/button/demo/light.md +26 -0
- package/components/button/demo/loading.md +1 -1
- package/components/button/demo/normal.md +25 -0
- package/components/button/demo/size.md +2 -2
- package/components/button/demo/solid.md +16 -0
- package/components/button/demo/with-icon.md +4 -3
- package/components/button/index.md +3 -3
- package/components/button/styles/index.less +106 -45
- package/components/card/demo/base.md +1 -1
- package/components/card/demo/border.md +2 -2
- package/components/card/styles/index.less +6 -6
- package/components/carousel/styles/index.less +1 -1
- package/components/checkbox/demo/group-vertical.md +47 -0
- package/components/checkbox/demo/index.vue +4 -0
- package/components/checkbox/demo/options.md +46 -0
- package/components/checkbox/group.jsx +9 -3
- package/components/checkbox/index.md +8 -7
- package/components/checkbox/styles/index.less +30 -20
- package/components/collapse/styles/index.less +10 -10
- package/components/colorPicker/styles/index.less +14 -14
- package/components/datePicker/datepicker.jsx +11 -3
- package/components/datePicker/demo/index.vue +2 -0
- package/components/datePicker/demo/theme.md +34 -0
- package/components/datePicker/index.md +4 -1
- package/components/datePicker/styles/calendar.less +39 -38
- package/components/datePicker/styles/datepicker.less +37 -20
- package/components/divider/styles/index.less +6 -6
- package/components/drawer/styles/index.less +12 -10
- package/components/dropdown/demo/base.md +4 -4
- package/components/dropdown/demo/cascading.md +3 -3
- package/components/dropdown/demo/divider.md +3 -3
- package/components/dropdown/styles/index.less +4 -4
- package/components/empty/styles/index.less +2 -2
- package/components/form/demo/base.md +25 -2
- package/components/form/demo/index.vue +1 -1
- package/components/form/demo/valid.md +9 -0
- package/components/form/form.jsx +2 -0
- package/components/form/formitem.jsx +18 -10
- package/components/form/styles/index.less +17 -13
- package/components/grid/styles/index.less +1 -1
- package/components/icon/demo/base.md +4 -4
- package/components/icon/demo/search.vue +6 -9
- package/components/image/styles/index.less +18 -18
- package/components/index.js +3 -1
- package/components/input/demo/index.vue +3 -1
- package/components/input/demo/theme.md +39 -0
- package/components/input/index.md +9 -6
- package/components/input/input.jsx +10 -3
- package/components/input/styles/index.less +120 -78
- package/components/input/textarea.jsx +1 -0
- package/components/layout/demo/base.md +5 -3
- package/components/layout/demo/index.vue +0 -2
- package/components/layout/demo/info.md +0 -2
- package/components/layout/demo/layout1.md +40 -47
- package/components/layout/demo/layout2.md +42 -49
- package/components/layout/demo/layout3.md +44 -22
- package/components/layout/demo/layout4.md +19 -18
- package/components/layout/demo/layout5.md +47 -44
- package/components/layout/styles/index.less +1 -6
- package/components/loading/styles/index.less +4 -4
- package/components/menu/demo/accrodion.md +2 -2
- package/components/menu/demo/base.md +5 -13
- package/components/menu/demo/collapsed.md +2 -2
- package/components/menu/demo/index.vue +0 -2
- package/components/menu/demo/inline.md +6 -10
- package/components/menu/demo/mode.md +2 -2
- package/components/menu/demo/theme.md +2 -2
- package/components/menu/demo/vertical.md +2 -2
- package/components/menu/index.md +0 -3
- package/components/menu/menu.jsx +4 -4
- package/components/menu/menuitem.jsx +1 -13
- package/components/menu/styles/dropmenu.less +28 -20
- package/components/menu/styles/index.less +148 -251
- package/components/menu/submenu.jsx +4 -64
- package/components/message/group.jsx +1 -1
- package/components/message/styles/index.less +13 -8
- package/components/modal/demo/base.md +15 -2
- package/components/modal/demo/custom.md +2 -2
- package/components/modal/demo/more.md +6 -6
- package/components/modal/modal.jsx +11 -5
- package/components/modal/styles/index.less +24 -17
- package/components/notice/styles/index.less +14 -13
- package/components/page/styles/index.less +16 -16
- package/components/popconfirm/styles/index.less +6 -6
- package/components/poptip/styles/index.less +10 -9
- package/components/progress/styles/index.less +13 -13
- package/components/radio/button.jsx +2 -2
- package/components/radio/demo/button.md +3 -3
- package/components/radio/demo/group-vertical.md +46 -0
- package/components/radio/demo/index.vue +4 -0
- package/components/radio/demo/options.md +43 -0
- package/components/radio/group.jsx +14 -8
- package/components/radio/index.md +11 -9
- package/components/radio/styles/index.less +33 -22
- package/components/rate/styles/index.less +2 -2
- package/components/select/demo/icon.md +40 -0
- package/components/select/demo/index.vue +4 -0
- package/components/select/demo/size.md +5 -5
- package/components/select/demo/theme.md +46 -0
- package/components/select/index.md +5 -2
- package/components/select/select.jsx +20 -13
- package/components/select/styles/index.less +113 -49
- package/components/slider/slider.jsx +9 -4
- package/components/slider/styles/index.less +7 -7
- package/components/space/demo/align.md +1 -1
- package/components/spin/styles/index.less +7 -11
- package/components/steps/styles/index.less +11 -11
- package/components/styles/color.less +158 -0
- package/components/styles/index.less +3 -1
- package/components/styles/sys.less +34 -0
- package/components/styles/var.less +150 -0
- package/components/switch/styles/index.less +11 -11
- package/components/table/styles/index.less +29 -32
- package/components/tabs/styles/index.less +20 -19
- package/components/tag/styles/index.less +45 -45
- package/components/timeline/styles/index.less +5 -5
- package/components/tooltip/styles/index.less +19 -18
- package/components/tree/styles/index.less +15 -15
- package/components/treeselect/styles/index.less +5 -5
- package/components/upload/demo/accept.md +68 -0
- package/components/upload/demo/avatar.md +40 -0
- package/components/upload/demo/base.md +40 -0
- package/components/upload/demo/custom.md +47 -0
- package/components/upload/demo/directory.md +36 -0
- package/components/upload/demo/drag.md +0 -0
- package/components/upload/demo/draggable.md +45 -0
- package/components/upload/demo/exceed.md +42 -0
- package/components/upload/demo/file-list.md +42 -0
- package/components/upload/demo/form.md +120 -0
- package/components/upload/demo/index.vue +37 -0
- package/components/upload/demo/info.md +10 -0
- package/components/upload/demo/picture.md +54 -0
- package/components/upload/index.md +26 -0
- package/components/upload/styles/index.less +258 -0
- package/components/upload/upload.jsx +336 -0
- package/dist/k-ui.css +1 -1
- package/dist/k-ui.js +2 -2
- package/package.json +9 -4
- package/components/button/demo/hollow.md +0 -15
- package/components/layout/demo/layout6.md +0 -142
- package/components/menu/demo/vertical-affix.md +0 -69
- package/components/styles/dark.less +0 -70
- package/components/styles/global-dark.less +0 -36
- package/components/styles/global.less +0 -44
- package/components/upload/upload.vue +0 -137
- package/dist/k-ui-dark.css +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 组合垂直布局
|
|
3
|
+
组合垂直布局
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<p>Selected:{{data}}</p>
|
|
10
|
+
<br />
|
|
11
|
+
<Button @click="data=''" size="small">Clear</Button>
|
|
12
|
+
<Button @click="data='apple'" size="small">Select apple</Button>
|
|
13
|
+
<br />
|
|
14
|
+
<br />
|
|
15
|
+
<RadioGroup v-model="data" direction="vertical">
|
|
16
|
+
<Radio label="Apple" value="apple" />
|
|
17
|
+
<Radio label="Orange" value="orange" />
|
|
18
|
+
<Radio label="Banana" value="banana" />
|
|
19
|
+
<Radio label="Grape" value="grape" disabled/>
|
|
20
|
+
<Radio label="Pear" value="pear" disabled/>
|
|
21
|
+
</RadioGroup>
|
|
22
|
+
<br/>
|
|
23
|
+
<p>{{cities}}</p>
|
|
24
|
+
<br/>
|
|
25
|
+
<RadioGroup :options="options" v-model="cities" direction="vertical"/>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
checked: true,
|
|
33
|
+
data: 'apple',
|
|
34
|
+
options: [
|
|
35
|
+
{ label: 'Beijing', value: 'beijing' },
|
|
36
|
+
{ label: 'Shenzhen', value: 'shenzhen' },
|
|
37
|
+
{ label: 'Shanghai', value: 'shanghai' },
|
|
38
|
+
{ label: 'Guangzhou', value: 'guangzhou' },
|
|
39
|
+
{ label: 'Wuhan', value: 'wuhan' },
|
|
40
|
+
],
|
|
41
|
+
cities:'wuhan'
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
@@ -3,6 +3,8 @@ import Base from './base'
|
|
|
3
3
|
import Info from './info'
|
|
4
4
|
import Disabled from './disabled'
|
|
5
5
|
import Group from './group'
|
|
6
|
+
import Options from './options'
|
|
7
|
+
import GroupVertical from './group-vertical'
|
|
6
8
|
import Button from './button'
|
|
7
9
|
import CN from '../index.md'
|
|
8
10
|
export default {
|
|
@@ -12,7 +14,9 @@ export default {
|
|
|
12
14
|
<Info class="typo" />
|
|
13
15
|
<Base />
|
|
14
16
|
<Disabled />
|
|
17
|
+
<Options />
|
|
15
18
|
<Group />
|
|
19
|
+
<GroupVertical />
|
|
16
20
|
<Button />
|
|
17
21
|
<CN class="typo"/>
|
|
18
22
|
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 组合使用Options
|
|
3
|
+
- 组合使用可以直接使用 `RadioGroup` 的 `options` 来赋值,
|
|
4
|
+
- 或者结合子组件 `Radio` 来组合使用,通过 `disabled` 可以设置组件是否被禁用
|
|
5
|
+
</cn>
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<div>
|
|
10
|
+
<RadioGroup :options="types" v-model="direction" type="button" theme="solid"/>
|
|
11
|
+
<br />
|
|
12
|
+
<br />
|
|
13
|
+
<RadioGroup
|
|
14
|
+
:options="options"
|
|
15
|
+
v-model="cities"
|
|
16
|
+
@change="change"
|
|
17
|
+
:direction="direction"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
direction:'horizontal',
|
|
26
|
+
types:[
|
|
27
|
+
{ label: '垂直', value:'vertical'},
|
|
28
|
+
{ label: '水平' ,value:'horizontal'}
|
|
29
|
+
],
|
|
30
|
+
options: [
|
|
31
|
+
{ label: 'Beijing', value: 'beijing' },
|
|
32
|
+
{ label: 'Shenzhen', value: 'shenzhen' },
|
|
33
|
+
{ label: 'Shanghai', value: 'shanghai' },
|
|
34
|
+
{ label: 'Guangzhou', value: 'guangzhou' },
|
|
35
|
+
{ label: 'Wuhan', value: 'wuhan' },
|
|
36
|
+
{ label: 'Other', value: 'other',disabled:true },
|
|
37
|
+
],
|
|
38
|
+
cities:'wuhan'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
@@ -6,14 +6,19 @@ export default {
|
|
|
6
6
|
props: {
|
|
7
7
|
value: { type: [String, Number], default: "" },
|
|
8
8
|
disabled: Boolean,
|
|
9
|
+
direction: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'horizontal',
|
|
12
|
+
validator: (val) => ['horizontal', 'vertical'].indexOf(val) >= 0
|
|
13
|
+
},
|
|
9
14
|
size: {
|
|
10
15
|
default: 'default',
|
|
11
16
|
validator(value) {
|
|
12
17
|
return ["small", "large", "default"].indexOf(value) >= 0;
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
theme: String,
|
|
21
|
+
shape: String,
|
|
17
22
|
options: Array,
|
|
18
23
|
type: String,
|
|
19
24
|
},
|
|
@@ -37,16 +42,18 @@ export default {
|
|
|
37
42
|
let value = data.value
|
|
38
43
|
this.defaultValue = value
|
|
39
44
|
this.$emit("input", value);
|
|
40
|
-
this.$emit("change",
|
|
45
|
+
this.$emit("change", data);
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
48
|
render() {
|
|
44
|
-
const { options, $slots, type } = this
|
|
49
|
+
const { options, $slots, type, direction,theme,shape } = this
|
|
45
50
|
let childs = getChild($slots.default)
|
|
46
51
|
if (options && options.length) {
|
|
47
52
|
childs = options.map(option => {
|
|
48
53
|
return type == 'button' ?
|
|
49
54
|
<Button
|
|
55
|
+
theme={theme}
|
|
56
|
+
shape={shape}
|
|
50
57
|
icon={option.icon}
|
|
51
58
|
key={option.value}
|
|
52
59
|
value={option.value}
|
|
@@ -64,12 +71,11 @@ export default {
|
|
|
64
71
|
}
|
|
65
72
|
const classes = [
|
|
66
73
|
'k-radio-group',
|
|
67
|
-
{ 'k-radio-cirle':
|
|
74
|
+
{ 'k-radio-cirle': shape=='circle' },
|
|
75
|
+
{ 'k-radio-group-vertical': direction == 'vertical' }
|
|
68
76
|
]
|
|
69
77
|
return (
|
|
70
|
-
<div class={classes}>
|
|
71
|
-
{childs}
|
|
72
|
-
</div>
|
|
78
|
+
<div class={classes}>{childs}</div>
|
|
73
79
|
)
|
|
74
80
|
}
|
|
75
81
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
### Radio API
|
|
2
2
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
3
|
-
|
|
3
|
+
| -------- | --------------------------------------------- | ----------------- | ------ |
|
|
4
4
|
| checked | 是否选中状态,可以使用 `v-model` 双向绑定数据 | Boolean | false |
|
|
5
5
|
| label | 文字提示 | String 、 Number | - |
|
|
6
6
|
| disabled | 是否禁用当前项 | Boolean | false |
|
|
7
7
|
| change | 在选项状态发生改变时回调 | Function(e:Event) | - |
|
|
8
8
|
### RadioGroup API
|
|
9
|
-
| 属性
|
|
10
|
-
|
|
11
|
-
| value
|
|
12
|
-
| size
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
9
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
10
|
+
| --------- | -------------------------------------------------------------------------- | ------------------------------------------------- | ---------- |
|
|
11
|
+
| value | 用于设置当前选中的值。可以使用 `v-model` 双向绑定数据 | Any | - |
|
|
12
|
+
| size | 按钮尺寸,可选值 `small`、`large`,默认不选 | Sting | - |
|
|
13
|
+
| direction | 布局方向,可选值 `horizontal`、`vertical` | Sting | horizontal |
|
|
14
|
+
| shape | `button` 的 shape 属性 ,显示圆角 | String | - |
|
|
15
|
+
| theme | `button` 的 theme 属性 | String | - |
|
|
16
|
+
| change | 在选项状态发生改变时触发,返回当前选中的项 | Function | - |
|
|
17
|
+
| options | 可以指定子项 `radio` | Array <{label:string/number,value:string/number}> | - |
|
|
18
|
+
| type | 如果使用 `options` 来渲染子集,并且子集为 `button`,需要指定 `type=button` | String | - |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '../../styles/
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
2
|
.k-radio-group {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
// font-size: 0;
|
|
@@ -13,26 +13,29 @@
|
|
|
13
13
|
z-index: 2;
|
|
14
14
|
}
|
|
15
15
|
&:first-child {
|
|
16
|
-
border-top-left-radius:
|
|
17
|
-
border-bottom-left-radius:
|
|
16
|
+
border-top-left-radius: var(--kui-border-radius);
|
|
17
|
+
border-bottom-left-radius: var(--kui-border-radius);
|
|
18
18
|
}
|
|
19
19
|
&:last-child {
|
|
20
|
-
border-top-right-radius:
|
|
21
|
-
border-bottom-right-radius:
|
|
20
|
+
border-top-right-radius: var(--kui-border-radius);
|
|
21
|
+
border-bottom-right-radius: var(--kui-border-radius);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
.k-btn-hollow {
|
|
25
|
-
color:
|
|
26
|
-
border-color:
|
|
25
|
+
color: var(--kui-color-font);
|
|
26
|
+
border-color: var(--kui-color-border);
|
|
27
27
|
}
|
|
28
28
|
.k-btn-primary.k-btn-hollow {
|
|
29
29
|
z-index: 2;
|
|
30
|
-
color:
|
|
31
|
-
border-color:
|
|
30
|
+
color: var(--kui-color-main);
|
|
31
|
+
border-color: var(--kui-color-main);
|
|
32
32
|
}
|
|
33
33
|
.k-radio-wrapper {
|
|
34
34
|
margin-right: 16px;
|
|
35
35
|
}
|
|
36
|
+
.k-radio-label{
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
.k-radio-cirle {
|
|
@@ -49,10 +52,9 @@
|
|
|
49
52
|
.k-radio-wrapper {
|
|
50
53
|
user-select: none;
|
|
51
54
|
cursor: pointer;
|
|
52
|
-
font-size: 12px;
|
|
53
55
|
display: inline-block;
|
|
54
56
|
line-height: 1;
|
|
55
|
-
color:
|
|
57
|
+
color: var(--kui-color-font);
|
|
56
58
|
.k-radio {
|
|
57
59
|
display: inline-block;
|
|
58
60
|
vertical-align: middle;
|
|
@@ -72,9 +74,9 @@
|
|
|
72
74
|
position: relative;
|
|
73
75
|
top: 0;
|
|
74
76
|
left: 0;
|
|
75
|
-
border: 1px solid
|
|
77
|
+
border: 1px solid var(--kui-color-border);
|
|
76
78
|
border-radius: 2px;
|
|
77
|
-
background-color:
|
|
79
|
+
background-color: var(--kui-color-back);
|
|
78
80
|
transition: border-color .2s ease-in-out, background-color .2s ease-in-out;
|
|
79
81
|
border-radius: 50%;
|
|
80
82
|
&:after {
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
display: block;
|
|
89
91
|
content: " ";
|
|
90
92
|
opacity: 0;
|
|
91
|
-
background-color:
|
|
93
|
+
background-color: var(--kui-color-main);
|
|
92
94
|
transition: all .2s ease-in-out;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -105,8 +107,8 @@
|
|
|
105
107
|
opacity: 0;
|
|
106
108
|
&:focus {
|
|
107
109
|
+.k-radio-inner {
|
|
108
|
-
border: 1px solid
|
|
109
|
-
box-shadow: 0 0 5px
|
|
110
|
+
border: 1px solid var(--kui-color-main);
|
|
111
|
+
box-shadow: 0 0 5px var(--kui-color-main-30);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}
|
|
@@ -118,8 +120,8 @@
|
|
|
118
120
|
|
|
119
121
|
.k-radio-checked {
|
|
120
122
|
.k-radio-inner {
|
|
121
|
-
background:
|
|
122
|
-
border-color:
|
|
123
|
+
background: var(--kui-color-back);
|
|
124
|
+
border-color: var(--kui-color-main);
|
|
123
125
|
position: relative;
|
|
124
126
|
&:after {
|
|
125
127
|
opacity: 1;
|
|
@@ -134,17 +136,26 @@
|
|
|
134
136
|
.k-radio-disabled {
|
|
135
137
|
cursor: not-allowed;
|
|
136
138
|
// opacity: .5;
|
|
137
|
-
color:
|
|
139
|
+
color: var(--kui-color-disable-color);
|
|
138
140
|
.k-radio {
|
|
139
141
|
.k-radio-input {
|
|
140
142
|
cursor: not-allowed;
|
|
141
143
|
}
|
|
142
144
|
.k-radio-inner {
|
|
143
|
-
background:
|
|
144
|
-
border-color:
|
|
145
|
+
background: var(--kui-color-disable-back);
|
|
146
|
+
border-color: var(--kui-color-disable-border);
|
|
145
147
|
&:after {
|
|
146
|
-
background-color:
|
|
148
|
+
background-color: var(--kui-color-disable-border);
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.k-radio-group-vertical {
|
|
155
|
+
display: block;
|
|
156
|
+
.k-radio-wrapper {
|
|
157
|
+
display: block;
|
|
158
|
+
margin-right: 0;
|
|
159
|
+
margin-bottom: 16px;
|
|
160
|
+
}
|
|
150
161
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '../../styles/
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
2
|
.k-rate {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
font-size: 20px;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
opacity: 0;
|
|
20
20
|
}
|
|
21
21
|
.k-star-back {
|
|
22
|
-
color:
|
|
22
|
+
color: var(--kui-color-border);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
.k-star-checked {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 带图标
|
|
3
|
+
可以自定义图标
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<Select :width="200" icon="search" v-model="select" theme="light" arrow-icon="caret-down" :options="data"/>
|
|
10
|
+
<Button @click="select=''" size="small">Clear</Button>
|
|
11
|
+
<Button @click="select=1" size="small">Choose orange</Button>
|
|
12
|
+
<br />
|
|
13
|
+
<Select :width="200" icon="location-outline" arrow-icon="chevron-down-circle-outline">
|
|
14
|
+
<Option :value="1" label="Apple" />
|
|
15
|
+
<Option :value="2" label="Orange" />
|
|
16
|
+
<Option :value="3" label="Banana" disabled/>
|
|
17
|
+
<Option :value="4" label="Pear" />
|
|
18
|
+
</Select>
|
|
19
|
+
<br />
|
|
20
|
+
<Select :width="200" value="1" disabled icon="search">
|
|
21
|
+
<Option value="1" label="disabled" />
|
|
22
|
+
</Select>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
<script>
|
|
26
|
+
export default {
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
select: 2,
|
|
30
|
+
data: [
|
|
31
|
+
{ label: "Apple", value: 0 },
|
|
32
|
+
{ label: "Orange", value: 1 },
|
|
33
|
+
{ label: "Banana", value: 2 },
|
|
34
|
+
{ label: "Pear", value: 3 },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Info from './info'
|
|
3
3
|
import Base from './base'
|
|
4
|
+
import Theme from './theme'
|
|
5
|
+
import Icons from './icon'
|
|
4
6
|
import Size from './size'
|
|
5
7
|
import Clearable from './clearable'
|
|
6
8
|
import NoBordered from './nobordered'
|
|
@@ -14,6 +16,8 @@ export default {
|
|
|
14
16
|
<div class="demo-select">
|
|
15
17
|
<Info class="typo" />
|
|
16
18
|
<Base />
|
|
19
|
+
<Theme />
|
|
20
|
+
<Icons />
|
|
17
21
|
<Size />
|
|
18
22
|
<Clearable />
|
|
19
23
|
<NoBordered />
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<div>
|
|
9
|
-
<RadioGroup :value="size" @change="setSize">
|
|
9
|
+
<RadioGroup :value="size" @change="setSize" icon="search">
|
|
10
10
|
<RadioButton value="large" label="large"/>
|
|
11
11
|
<RadioButton value="default" label="default"/>
|
|
12
12
|
<RadioButton value="small" label="small"/>
|
|
13
13
|
</RadioGroup>
|
|
14
14
|
<br />
|
|
15
15
|
<br />
|
|
16
|
-
<Select :width="256" :size="size" clearable filterable
|
|
16
|
+
<Select :width="256" :size="size" clearable filterable icon="search">
|
|
17
17
|
<Option value="1" label="Apple" />
|
|
18
18
|
<Option value="2" label="Orange" />
|
|
19
19
|
<Option value="3" label="Banana"/>
|
|
20
20
|
<Option value="4" label="Pear" />
|
|
21
21
|
</Select>
|
|
22
22
|
<br />
|
|
23
|
-
<Select :width="256" :size="size" multiple v-model="value" filterable
|
|
23
|
+
<Select :width="256" :size="size" multiple v-model="value" filterable icon="search">
|
|
24
24
|
<Option value="1" label="Apple" />
|
|
25
25
|
<Option value="2" label="Orange" />
|
|
26
26
|
<Option value="3" label="Banana" />
|
|
@@ -37,8 +37,8 @@ export default{
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
methods:{
|
|
40
|
-
setSize(
|
|
41
|
-
this.size =
|
|
40
|
+
setSize({value}){
|
|
41
|
+
this.size = value
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 主题
|
|
3
|
+
通过 `theme` 设置主题 , shape='circle' ,呈现圆角, multiple 多选模式下, shape 无效
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<Checkbox v-model="checked" label="Shape" />
|
|
10
|
+
<br/>
|
|
11
|
+
<br/>
|
|
12
|
+
<Select :width="256" icon="search" theme="light" :shape="checked?'circle':''"/>
|
|
13
|
+
<br/>
|
|
14
|
+
<Select :width="256" clearable filterable theme="light" :shape="checked?'circle':''">
|
|
15
|
+
<Option value="1" label="Apple" />
|
|
16
|
+
<Option value="2" label="Orange" />
|
|
17
|
+
<Option value="3" label="Banana"/>
|
|
18
|
+
<Option value="4" label="Pear" />
|
|
19
|
+
</Select>
|
|
20
|
+
<br/>
|
|
21
|
+
<Select :width="256" icon="search" :shape="checked?'circle':''"/>
|
|
22
|
+
<br />
|
|
23
|
+
<Select :width="256" multiple v-model="value" filterable theme="light">
|
|
24
|
+
<Option value="1" label="Apple" />
|
|
25
|
+
<Option value="2" label="Orange" />
|
|
26
|
+
<Option value="3" label="Banana" />
|
|
27
|
+
<Option value="4" label="Pear" />
|
|
28
|
+
</Select>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<script>
|
|
32
|
+
export default{
|
|
33
|
+
data(){
|
|
34
|
+
return{
|
|
35
|
+
checked:true,
|
|
36
|
+
value:['1','3']
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
methods:{
|
|
40
|
+
setSize({value}){
|
|
41
|
+
this.size = value
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
### Select API
|
|
2
2
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
3
|
-
|
|
3
|
+
| ----------- | ---------------------------------------------------------- | ------------------------------ | ------ |
|
|
4
4
|
| value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number | - |
|
|
5
5
|
| width | 组件宽度 | String,Number | - |
|
|
6
6
|
| placeholder | 选择框默认文字 | String | 请选择 |
|
|
@@ -15,10 +15,13 @@
|
|
|
15
15
|
| change | 在选项状态发生改变时触发,返回选择项{value:xx,label:xx} | Function | - |
|
|
16
16
|
| open-change | 下拉框展开或收起时触发 | Function | - |
|
|
17
17
|
| options | options 数据,如果设置则不需要手动构造 Option 节点 | Array <{value,label,disabled}> | [] |
|
|
18
|
+
| theme | theme='light' 时呈现浅色主题 | String | - |
|
|
19
|
+
| icon | 自定义图标 | String | - |
|
|
20
|
+
| shape | shape='circle' 时呈现圆角 | String | - |
|
|
18
21
|
|
|
19
22
|
### Option API
|
|
20
23
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
21
|
-
|
|
24
|
+
| -------- | -------------------------------------------------------------------------------------------- | ------------- | ------ |
|
|
22
25
|
| key | 和 value 含义一致。如果 Vue 需要你设置此项,此项值与 value 的值相同,然后可以省略 value 设置 | String,Number | - |
|
|
23
26
|
| value | 选项值,默认根据此属性值进行筛选,必填 | String,Number | - |
|
|
24
27
|
| label | 选项显示的内容 | String,Number | - |
|
|
@@ -25,7 +25,11 @@ export default {
|
|
|
25
25
|
loading: Boolean,
|
|
26
26
|
bordered: { type: Boolean, default: true },
|
|
27
27
|
showArrow: { type: Boolean, default: true },
|
|
28
|
-
options: Array
|
|
28
|
+
options: Array,
|
|
29
|
+
theme: String,
|
|
30
|
+
icon: String,
|
|
31
|
+
shape: String,
|
|
32
|
+
arrowIcon: { type: String, default: 'chevron-down' },
|
|
29
33
|
},
|
|
30
34
|
provide() {
|
|
31
35
|
return {
|
|
@@ -76,6 +80,7 @@ export default {
|
|
|
76
80
|
},
|
|
77
81
|
setLabel() {
|
|
78
82
|
let { currentValue, multiple, label } = this
|
|
83
|
+
|
|
79
84
|
currentValue = isNotEmpty(currentValue) ? currentValue : (multiple ? [] : '')
|
|
80
85
|
let currentLabel = isNotEmpty(label) ? label : (multiple ? [] : '')
|
|
81
86
|
|
|
@@ -151,6 +156,8 @@ export default {
|
|
|
151
156
|
},
|
|
152
157
|
change(item) {
|
|
153
158
|
let { multiple, value, currentValue } = this
|
|
159
|
+
// console.log(value, currentValue)
|
|
160
|
+
|
|
154
161
|
if (this.showSearch) {
|
|
155
162
|
this.queryKey = ''
|
|
156
163
|
this.$refs.search.value = ''
|
|
@@ -163,7 +170,6 @@ export default {
|
|
|
163
170
|
this.$nextTick(e => this.$refs.search.focus())
|
|
164
171
|
}
|
|
165
172
|
let hasValue = hasProp(this, 'value')
|
|
166
|
-
|
|
167
173
|
//set value
|
|
168
174
|
if (multiple) {
|
|
169
175
|
if (!hasValue) {
|
|
@@ -175,7 +181,6 @@ export default {
|
|
|
175
181
|
} else {
|
|
176
182
|
value.splice(index, 1)
|
|
177
183
|
}
|
|
178
|
-
|
|
179
184
|
} else {
|
|
180
185
|
value = item.value
|
|
181
186
|
}
|
|
@@ -197,12 +202,10 @@ export default {
|
|
|
197
202
|
}
|
|
198
203
|
setTimeout(e => { this.setPosition() }, 230);
|
|
199
204
|
} else {
|
|
200
|
-
|
|
201
205
|
this.$nextTick(e => this.setPosition())
|
|
202
206
|
}
|
|
203
207
|
this.$emit("input", value);
|
|
204
208
|
this.$emit("change", item);
|
|
205
|
-
|
|
206
209
|
},
|
|
207
210
|
removeTag(e, i) {
|
|
208
211
|
if (this.disabled) return
|
|
@@ -263,18 +266,21 @@ export default {
|
|
|
263
266
|
render() {
|
|
264
267
|
let { disabled, size, multiple,
|
|
265
268
|
opened, placeholder, showArrow, bordered,
|
|
266
|
-
clear, removeTag, queryKey,
|
|
269
|
+
clear, removeTag, queryKey, theme, arrowIcon, icon, shape,filterable,
|
|
267
270
|
clearable, label, toggleDrop, transfer } = this
|
|
268
271
|
let childNode = []
|
|
269
272
|
|
|
270
273
|
const classes = [
|
|
271
274
|
"k-select",
|
|
272
275
|
{
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
"k-select-disabled": disabled,
|
|
277
|
+
"k-select-open": opened,
|
|
275
278
|
'k-select-borderless': bordered === false,
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
"k-select-lg": size == 'large',
|
|
280
|
+
"k-select-sm": size == 'small',
|
|
281
|
+
"k-select-light": theme == 'light',
|
|
282
|
+
"k-select-has-icon": !!icon,
|
|
283
|
+
"k-select-circle": shape == 'circle' && !multiple,
|
|
278
284
|
}
|
|
279
285
|
]
|
|
280
286
|
|
|
@@ -347,9 +353,9 @@ export default {
|
|
|
347
353
|
childNode.push(labelsNode);
|
|
348
354
|
childNode.push(placeNode);
|
|
349
355
|
|
|
350
|
-
(!isSearch && showArrow) && childNode.push(<Icon class="k-select-arrow" type=
|
|
356
|
+
(!isSearch && showArrow) && childNode.push(<Icon class="k-select-arrow" type={arrowIcon} />)
|
|
351
357
|
|
|
352
|
-
if ((
|
|
358
|
+
if ((filterable || isSearch) && !multiple) {
|
|
353
359
|
childNode.push(queryNode)
|
|
354
360
|
}
|
|
355
361
|
|
|
@@ -357,7 +363,7 @@ export default {
|
|
|
357
363
|
let showClear = !disabled && clearable && isNotEmpty(label) && label.length > 0
|
|
358
364
|
const selectCls = [
|
|
359
365
|
"k-select-selection", {
|
|
360
|
-
"k-select-has-clear": showClear
|
|
366
|
+
"k-select-has-clear": showClear,
|
|
361
367
|
}
|
|
362
368
|
]
|
|
363
369
|
showClear && childNode.push(<Icon class="k-select-clearable" type="close-circle" onClick={clear} />)
|
|
@@ -365,6 +371,7 @@ export default {
|
|
|
365
371
|
return (
|
|
366
372
|
<div tabIndex="0" class={classes} style={styles}>
|
|
367
373
|
<div class={selectCls} onClick={toggleDrop} ref="rel">
|
|
374
|
+
{icon ? <Icon type={icon} class="k-select-icon" /> : null}
|
|
368
375
|
{childNode}
|
|
369
376
|
</div>
|
|
370
377
|
{overlay}
|