kui-vue 3.6.0 → 3.6.1
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/{readme.md → README.md} +4 -10
- package/components/button/demo/group.md +1 -1
- package/components/card/card.jsx +1 -1
- package/components/checkbox/checkboxGroup.jsx +4 -4
- package/components/checkbox/demo/group.md +17 -6
- package/components/checkbox/styles/index.less +4 -11
- package/components/colorPicker/colorpicker.jsx +5 -6
- package/components/colorPicker/demo/customTrigger.md +2 -2
- package/components/colorPicker/demo/mode.md +1 -4
- package/components/datePicker/datepicker.jsx +19 -11
- package/components/datePicker/demo/basic.md +15 -6
- package/components/datePicker/demo/lang.md +2 -2
- package/components/drawer/drawer.jsx +2 -2
- package/components/dropdown/dropdown.jsx +9 -40
- package/components/form/demo/valid.md +1 -0
- package/components/image/image.jsx +1 -0
- package/components/input/index.md +1 -1
- package/components/inputNumber/demo/basic.md +12 -5
- package/components/inputNumber/demo/format.md +0 -5
- package/components/inputNumber/index.md +1 -1
- package/components/inputNumber/inputNumber.jsx +3 -5
- package/components/inputNumber/styles/index.less +64 -64
- package/components/menu/submenu.jsx +5 -5
- package/components/page/page.jsx +0 -1
- package/components/popconfirm/popconfirm.jsx +4 -4
- package/components/poptip/poptip.jsx +4 -4
- package/components/radio/demo/group.md +16 -6
- package/components/radio/demo/radioButton.md +3 -8
- package/components/radio/radioGroup.jsx +8 -11
- package/components/radio/styles/index.less +10 -21
- package/components/select/demo/basic.md +16 -7
- package/components/select/demo/filterable.md +4 -2
- package/components/select/index.md +23 -22
- package/components/select/option.jsx +7 -3
- package/components/select/select.jsx +43 -36
- package/components/select/styles/index.less +1 -0
- package/components/slider/demo/basic.md +2 -1
- package/components/slider/demo/withNumber.md +3 -3
- package/components/slider/slider.jsx +0 -25
- package/components/space/styles/index.less +3 -1
- package/components/styles/sys.less +3 -0
- package/components/switch/switch.jsx +15 -5
- package/components/table/styles/index.less +10 -5
- package/components/table/table.jsx +98 -69
- package/components/tooltip/tooltip.jsx +3 -3
- package/components/treeselect/demo/size.md +2 -2
- package/components/treeselect/treeselect.jsx +15 -20
- package/components/utils/placement.js +137 -126
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +118 -115
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +5 -5
- package/test/i18n@8.x.html +6 -2
- package/types/image/KImage.d.ts +1 -0
- package/types/index.d.ts +10 -10
- package/types/switch/Switch.d.ts +2 -0
- package/components/steps/index.js +0 -4
- package/components/steps/step.vue +0 -82
- package/components/steps/steps.vue +0 -68
- package/components/steps/styles/index.less +0 -198
|
@@ -32,79 +32,79 @@
|
|
|
32
32
|
.k-input-number-clearable-hidden {
|
|
33
33
|
visibility: hidden;
|
|
34
34
|
}
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
.k-input-number-controls {
|
|
38
|
+
transition: all 0.15s ease-in-out;
|
|
39
|
+
user-select: none;
|
|
40
|
+
// position: absolute;
|
|
41
|
+
// right: 0;
|
|
42
|
+
// top: 0;
|
|
43
|
+
// width: 20px;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
color: var(--kui-color-icon);
|
|
47
|
+
border-left: 1px solid var(--kui-color-border);
|
|
48
|
+
background-color: var(--kui-color-back);
|
|
49
|
+
font-size: 11px;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
height: 30px;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
width: 0;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
&:hover {
|
|
66
|
-
color: var(--kui-color-main);
|
|
67
|
-
background-color: var(--kui-color-hover);
|
|
68
|
-
}
|
|
58
|
+
.k-input-number-control {
|
|
59
|
+
flex: 1;
|
|
60
|
+
display: flex;
|
|
61
|
+
width: 100%;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
cursor: pointer;
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
&:hover {
|
|
67
|
+
color: var(--kui-color-main);
|
|
68
|
+
background-color: var(--kui-color-hover);
|
|
69
|
+
}
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
&:active {
|
|
72
|
+
color: var(--kui-color-main);
|
|
73
|
+
background-color: var(--kui-color-active);
|
|
74
|
+
}
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
&:first-child {
|
|
77
|
+
border-radius: 0 @radius 0 0;
|
|
78
|
+
}
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
&:last-child {
|
|
81
|
+
border-top: 1px solid var(--kui-color-border);
|
|
82
|
+
border-radius: 0 0 @radius 0;
|
|
83
|
+
|
|
84
|
+
.k-icon {
|
|
85
|
+
transform: rotate(180deg);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
90
|
+
.k-input-number-text {
|
|
91
|
+
padding-left: 0;
|
|
92
|
+
border: none;
|
|
93
|
+
height: 30px;
|
|
94
|
+
line-height: 1.5;
|
|
95
|
+
padding: 4px 0;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
color: var(--kui-color-font);
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
background-image: none;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
flex: 1;
|
|
102
|
+
min-width: 10px;
|
|
103
|
+
line-height: 1.571;
|
|
104
|
+
|
|
105
|
+
&:focus {
|
|
106
|
+
// border-color: var(--kui-color-main);
|
|
107
|
+
outline: none;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
.k-input-number-focus {
|
|
@@ -27,7 +27,7 @@ const SubMenu = defineComponent({
|
|
|
27
27
|
icon: [String, Array],
|
|
28
28
|
},
|
|
29
29
|
setup(ps, { slots, attrs }) {
|
|
30
|
-
const
|
|
30
|
+
const refSelection = ref(null);
|
|
31
31
|
const refPopper = ref();
|
|
32
32
|
const top = ref(0);
|
|
33
33
|
const left = ref(0);
|
|
@@ -54,7 +54,7 @@ const SubMenu = defineComponent({
|
|
|
54
54
|
|
|
55
55
|
onMounted(() => {
|
|
56
56
|
nextTick(() => {
|
|
57
|
-
const width =
|
|
57
|
+
const width = refSelection.value?.offsetWidth;
|
|
58
58
|
minWidth.value = `${width}px`;
|
|
59
59
|
|
|
60
60
|
if (openKeys.value.indexOf(key) >= 0) {
|
|
@@ -103,7 +103,7 @@ const SubMenu = defineComponent({
|
|
|
103
103
|
}
|
|
104
104
|
nextTick(() => {
|
|
105
105
|
setPlacement({
|
|
106
|
-
|
|
106
|
+
refSelection,
|
|
107
107
|
refPopper,
|
|
108
108
|
currentPlacement,
|
|
109
109
|
transOrigin,
|
|
@@ -178,7 +178,7 @@ const SubMenu = defineComponent({
|
|
|
178
178
|
const renderSubmenu = () => {
|
|
179
179
|
const inline = mode.value != "horizontal";
|
|
180
180
|
const opened = openKeys.value.indexOf(key) >= 0;
|
|
181
|
-
// todo: mode 从inline 切换 vertical 时
|
|
181
|
+
// todo: mode 从inline 切换 vertical 时 会卡一下
|
|
182
182
|
|
|
183
183
|
if (inline) {
|
|
184
184
|
const transitionProps = getTransitionProp("k-collapse-slide");
|
|
@@ -223,7 +223,7 @@ const SubMenu = defineComponent({
|
|
|
223
223
|
inlineCollapsed.value
|
|
224
224
|
) {
|
|
225
225
|
// popper
|
|
226
|
-
titleProps.ref =
|
|
226
|
+
titleProps.ref = refSelection;
|
|
227
227
|
// titleProps.onMouseenter = () => { for 3
|
|
228
228
|
titleProps.on.mouseenter = () => {
|
|
229
229
|
if (ps.disabled) return;
|
package/components/page/page.jsx
CHANGED
|
@@ -31,7 +31,6 @@ const Page = defineComponent({
|
|
|
31
31
|
current: { default: 1, type: Number },
|
|
32
32
|
},
|
|
33
33
|
setup(ps, { emit }) {
|
|
34
|
-
// todo: select
|
|
35
34
|
const nextPageGroup = ref(false);
|
|
36
35
|
const prevPageGroup = ref(false);
|
|
37
36
|
const pageCount = ref(Math.ceil(ps.total / ps.pageSize) || 1);
|
|
@@ -59,7 +59,7 @@ const Popconfirm = defineComponent({
|
|
|
59
59
|
const rendered = ref(false);
|
|
60
60
|
const visible = ref(false);
|
|
61
61
|
const refPopper = ref();
|
|
62
|
-
const
|
|
62
|
+
const refSelection = ref();
|
|
63
63
|
const left = ref(0);
|
|
64
64
|
const top = ref(0);
|
|
65
65
|
const currentPlacement = ref(ps.placement);
|
|
@@ -69,7 +69,7 @@ const Popconfirm = defineComponent({
|
|
|
69
69
|
const updatePosition = () => {
|
|
70
70
|
nextTick(() => {
|
|
71
71
|
setPlacement({
|
|
72
|
-
|
|
72
|
+
refSelection,
|
|
73
73
|
refPopper,
|
|
74
74
|
currentPlacement,
|
|
75
75
|
transOrigin,
|
|
@@ -101,7 +101,7 @@ const Popconfirm = defineComponent({
|
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
const outsideClick = (e) => {
|
|
104
|
-
const ctx =
|
|
104
|
+
const ctx = refSelection.value?.$el || refSelection.value;
|
|
105
105
|
if (
|
|
106
106
|
refPopper.value &&
|
|
107
107
|
!refPopper.value.contains(e.target) &&
|
|
@@ -152,7 +152,7 @@ const Popconfirm = defineComponent({
|
|
|
152
152
|
},
|
|
153
153
|
];
|
|
154
154
|
const wpProps = {
|
|
155
|
-
ref:
|
|
155
|
+
ref: refSelection,
|
|
156
156
|
// onClick: mouseEnter, //for 3
|
|
157
157
|
on: {
|
|
158
158
|
click: mouseEnter,
|
|
@@ -41,7 +41,7 @@ const Poptip = defineComponent({
|
|
|
41
41
|
const rendered = ref(ps.show);
|
|
42
42
|
const visible = ref(ps.show);
|
|
43
43
|
const refPopper = ref();
|
|
44
|
-
const
|
|
44
|
+
const refSelection = ref();
|
|
45
45
|
const left = ref(0);
|
|
46
46
|
const top = ref(0);
|
|
47
47
|
const currentPlacement = ref(ps.placement);
|
|
@@ -51,7 +51,7 @@ const Poptip = defineComponent({
|
|
|
51
51
|
const updatePosition = () => {
|
|
52
52
|
nextTick(() => {
|
|
53
53
|
setPlacement({
|
|
54
|
-
|
|
54
|
+
refSelection,
|
|
55
55
|
refPopper,
|
|
56
56
|
currentPlacement,
|
|
57
57
|
transOrigin,
|
|
@@ -89,7 +89,7 @@ const Poptip = defineComponent({
|
|
|
89
89
|
emit("update:show", value);
|
|
90
90
|
};
|
|
91
91
|
const outsideClick = (e) => {
|
|
92
|
-
const ctx =
|
|
92
|
+
const ctx = refSelection.value?.$el || refSelection.value;
|
|
93
93
|
if (
|
|
94
94
|
refPopper.value &&
|
|
95
95
|
!refPopper.value.contains(e.target) &&
|
|
@@ -132,7 +132,7 @@ const Poptip = defineComponent({
|
|
|
132
132
|
},
|
|
133
133
|
];
|
|
134
134
|
const wpProps = {
|
|
135
|
-
ref:
|
|
135
|
+
ref: refSelection,
|
|
136
136
|
// onMouseleave: hide, //for 3
|
|
137
137
|
on: { mouseleave: hide },
|
|
138
138
|
};
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical>
|
|
9
9
|
use options
|
|
10
|
-
<code>value: {{
|
|
11
|
-
<RadioGroup :options="options" v-model="
|
|
10
|
+
<code>value: {{ value }}</code>
|
|
11
|
+
<RadioGroup :options="options" v-model="value" />
|
|
12
12
|
<br />
|
|
13
13
|
use children
|
|
14
|
-
<RadioGroup v-model="
|
|
14
|
+
<RadioGroup v-model="value">
|
|
15
15
|
<Radio
|
|
16
16
|
:label="item.label"
|
|
17
17
|
:value="item.value"
|
|
@@ -23,13 +23,23 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
<script setup>
|
|
25
25
|
import { ref } from "vue";
|
|
26
|
-
const
|
|
27
|
-
const options = [
|
|
26
|
+
const value = ref("apple");
|
|
27
|
+
const options = ref([
|
|
28
28
|
{ label: "Apple", value: "apple" },
|
|
29
29
|
{ label: "Orange", value: "orange" },
|
|
30
30
|
{ label: "Banana", value: "banana" },
|
|
31
31
|
{ label: "Pear", value: "pear" },
|
|
32
32
|
{ label: "Grape", value: "grape" },
|
|
33
|
-
];
|
|
33
|
+
]);
|
|
34
|
+
// 异步更新数据
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
options.value = [
|
|
37
|
+
{ label: "Apple1", value: "apple" },
|
|
38
|
+
{ label: "Orange1", value: "orange" },
|
|
39
|
+
{ label: "Banana1", value: "banana" },
|
|
40
|
+
{ label: "Pear1", value: "pear" },
|
|
41
|
+
{ label: "Grape1", value: "grape" },
|
|
42
|
+
];
|
|
43
|
+
}, 1000);
|
|
34
44
|
</script>
|
|
35
45
|
```
|
|
@@ -7,23 +7,18 @@
|
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical>
|
|
9
9
|
<code>Shape : {{ shape }}</code>
|
|
10
|
-
<RadioGroup v-model="shape" size="small">
|
|
10
|
+
<RadioGroup v-model="shape" size="small" type="button">
|
|
11
11
|
<RadioButton value="default" label="Default" />
|
|
12
12
|
<RadioButton value="circle" label="Circle" />
|
|
13
13
|
</RadioGroup>
|
|
14
14
|
<code>Theme :{{ theme }}</code>
|
|
15
|
-
<RadioGroup v-model="theme" size="small">
|
|
15
|
+
<RadioGroup v-model="theme" size="small" type="button">
|
|
16
16
|
<RadioButton value="default" label="Default" />
|
|
17
17
|
<RadioButton value="light" label="Light" />
|
|
18
18
|
<RadioButton value="card" label="Card" />
|
|
19
19
|
</RadioGroup>
|
|
20
20
|
<code>Size :{{ size }}</code>
|
|
21
|
-
<RadioGroup
|
|
22
|
-
v-model="size"
|
|
23
|
-
type="button"
|
|
24
|
-
size="small"
|
|
25
|
-
:options="sizes"
|
|
26
|
-
>
|
|
21
|
+
<RadioGroup v-model="size" type="button" size="small" :options="sizes">
|
|
27
22
|
</RadioGroup>
|
|
28
23
|
<br />
|
|
29
24
|
<RadioGroup
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch } from "vue";
|
|
1
|
+
import { defineComponent, ref, watch, computed } from "vue";
|
|
2
2
|
import Radio from "./radio.jsx";
|
|
3
3
|
import RadioButton from "./radioButton.jsx";
|
|
4
4
|
import { withInstall } from "../utils/vue";
|
|
@@ -32,7 +32,6 @@ const RadioGroup = defineComponent({
|
|
|
32
32
|
setup(props, { slots, emit }) {
|
|
33
33
|
// [Vue 3 Upgrade]: const { modelValue: currentValue } = toRefs(props);
|
|
34
34
|
const currentValue = ref(props.value);
|
|
35
|
-
const currentType = ref(props.type);
|
|
36
35
|
const onChange = ({ value }) => {
|
|
37
36
|
currentValue.value = value;
|
|
38
37
|
// [Vue 3 Upgrade]: emit("update:modelValue", val);
|
|
@@ -45,7 +44,7 @@ const RadioGroup = defineComponent({
|
|
|
45
44
|
currentValue.value = val;
|
|
46
45
|
}
|
|
47
46
|
);
|
|
48
|
-
const optionsData = () => {
|
|
47
|
+
const optionsData = computed(() => {
|
|
49
48
|
let { options } = props;
|
|
50
49
|
if (!options) {
|
|
51
50
|
options = [];
|
|
@@ -55,9 +54,6 @@ const RadioGroup = defineComponent({
|
|
|
55
54
|
let { label, value, disabled, icon } =
|
|
56
55
|
child?.componentOptions?.propsData || {};
|
|
57
56
|
let { children = [], tag } = child?.componentOptions;
|
|
58
|
-
if (tag == "RadioButton") {
|
|
59
|
-
currentType.value = "button";
|
|
60
|
-
}
|
|
61
57
|
options.push({
|
|
62
58
|
value,
|
|
63
59
|
icon,
|
|
@@ -67,11 +63,11 @@ const RadioGroup = defineComponent({
|
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
return options;
|
|
70
|
-
};
|
|
66
|
+
});
|
|
71
67
|
return () => {
|
|
72
|
-
let options = optionsData
|
|
68
|
+
let options = optionsData.value;
|
|
73
69
|
let nodes = [];
|
|
74
|
-
const Component =
|
|
70
|
+
const Component = props.type === "button" ? RadioButton : Radio;
|
|
75
71
|
options.forEach((option) =>
|
|
76
72
|
nodes.push(
|
|
77
73
|
<Component
|
|
@@ -90,11 +86,12 @@ const RadioGroup = defineComponent({
|
|
|
90
86
|
const classes = [
|
|
91
87
|
"k-radio-group",
|
|
92
88
|
{
|
|
89
|
+
"k-radio-button-group": props.type === "button",
|
|
93
90
|
"k-radio-circle": props.shape === "circle",
|
|
94
91
|
"k-radio-group-light":
|
|
95
|
-
props.theme === "light" &&
|
|
92
|
+
props.theme === "light" && props.type === "button",
|
|
96
93
|
"k-radio-group-card":
|
|
97
|
-
props.theme === "card" &&
|
|
94
|
+
props.theme === "card" && props.type === "button",
|
|
98
95
|
"k-radio-group-vertical": props.direction === "vertical",
|
|
99
96
|
},
|
|
100
97
|
];
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
@import "../../styles/var.less";
|
|
2
2
|
|
|
3
3
|
.k-radio-group {
|
|
4
|
-
// display: inline-block;
|
|
5
4
|
display: inline-flex;
|
|
6
5
|
flex-shrink: 0;
|
|
7
6
|
align-items: center;
|
|
8
|
-
// font-size: 0;
|
|
9
|
-
// vertical-align: middle;
|
|
10
|
-
white-space: nowrap;
|
|
11
|
-
|
|
12
7
|
.k-btn {
|
|
13
8
|
position: relative;
|
|
14
9
|
margin-left: -1px;
|
|
@@ -46,19 +41,18 @@
|
|
|
46
41
|
border-color: var(--kui-color-main);
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
.k-radio {
|
|
50
|
-
margin-right: 16px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
.k-radio-label {
|
|
54
45
|
font-size: 14px;
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
// .k-btn-solid {
|
|
58
|
-
// margin-left: -1px;
|
|
59
|
-
// }
|
|
60
47
|
}
|
|
61
|
-
|
|
48
|
+
.k-radio-button-group,
|
|
49
|
+
.k-radio-group-card {
|
|
50
|
+
flex-wrap: nowrap;
|
|
51
|
+
}
|
|
52
|
+
.k-radio-group:not(.k-radio-button-group, .k-radio-group-card) {
|
|
53
|
+
gap: 16px;
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
}
|
|
62
56
|
.k-radio-circle:not(.k-radio-group-card) {
|
|
63
57
|
.k-btn:first-child {
|
|
64
58
|
border-top-left-radius: 30px;
|
|
@@ -208,13 +202,8 @@
|
|
|
208
202
|
}
|
|
209
203
|
|
|
210
204
|
.k-radio-group-vertical {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
.k-radio {
|
|
214
|
-
display: block;
|
|
215
|
-
margin-right: 0;
|
|
216
|
-
margin-bottom: 16px;
|
|
217
|
-
}
|
|
205
|
+
flex-direction: column;
|
|
206
|
+
align-items: self-start;
|
|
218
207
|
}
|
|
219
208
|
|
|
220
209
|
.k-radio-group-light {
|
|
@@ -11,11 +11,9 @@
|
|
|
11
11
|
<br />
|
|
12
12
|
use children to set options
|
|
13
13
|
<Select v-model="value2">
|
|
14
|
-
<Option :value="
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<Option :value="3" label="Banana" />
|
|
18
|
-
<Option :value="4" label="Pear" />
|
|
14
|
+
<Option :value="item.value" v-for="item in data" :key="item.value">
|
|
15
|
+
{{ item.label }}
|
|
16
|
+
</Option>
|
|
19
17
|
</Select>
|
|
20
18
|
</Space>
|
|
21
19
|
</template>
|
|
@@ -23,12 +21,23 @@
|
|
|
23
21
|
import { ref } from "vue";
|
|
24
22
|
const value1 = ref(2);
|
|
25
23
|
const value2 = ref(2);
|
|
26
|
-
const data = [
|
|
24
|
+
const data = ref([
|
|
27
25
|
{ label: "Apple", value: 0 },
|
|
28
26
|
{ label: "Orange", value: 1 },
|
|
29
27
|
{ label: "Banana", value: 2 },
|
|
30
28
|
{ label: "Pear", value: 3 },
|
|
31
29
|
{ label: "Grape", value: 4 },
|
|
32
|
-
];
|
|
30
|
+
]);
|
|
31
|
+
// 异步加载数据
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
data.value = [
|
|
34
|
+
{ label: "Apple1", value: 0 },
|
|
35
|
+
{ label: "Orange1", value: 1 },
|
|
36
|
+
{ label: "Banana2", value: 2 },
|
|
37
|
+
{ label: "Pear1", value: 3 },
|
|
38
|
+
{ label: "Grape2", value: 4 },
|
|
39
|
+
];
|
|
40
|
+
value2.value = 2;
|
|
41
|
+
}, 1000);
|
|
33
42
|
</script>
|
|
34
43
|
```
|
|
@@ -59,10 +59,12 @@ const value4 = ref([]);
|
|
|
59
59
|
const loading = ref(false);
|
|
60
60
|
|
|
61
61
|
const optionsData = ref([]);
|
|
62
|
-
const fetchData = () => {
|
|
62
|
+
const fetchData = (e) => {
|
|
63
63
|
loading.value = true;
|
|
64
64
|
setTimeout(() => {
|
|
65
|
-
optionsData.value = options
|
|
65
|
+
optionsData.value = options.filter((v) =>
|
|
66
|
+
v.includes(e.target.value.trim())
|
|
67
|
+
);
|
|
66
68
|
loading.value = false;
|
|
67
69
|
}, 1000);
|
|
68
70
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
## Select API
|
|
2
2
|
|
|
3
|
-
| 属性 | 说明 | 类型
|
|
4
|
-
| ----------- | ---------------------------------------------------------- |
|
|
5
|
-
| value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number
|
|
6
|
-
| width | 组件宽度 | String,Number
|
|
7
|
-
| placeholder | 选择框默认文字 | String
|
|
8
|
-
| disabled | 是否禁用当前项 | Boolean
|
|
9
|
-
| size | 组件尺寸大小,提供`small`,`large`两种尺寸,默认为正常 | String
|
|
10
|
-
| emptyText | 没有数据时展示的提示 | String
|
|
11
|
-
| maxTagCount | 最多展示多少个tag,超出部分以点点点展示 | Number
|
|
12
|
-
| multiple | 是否呈现多选模式 | Boolean
|
|
13
|
-
| loading | 是否显示异步加载 | Boolean
|
|
14
|
-
| clearable | 是否可以清空选项 | Boolean
|
|
15
|
-
| bordered | 是否显示边框 | Boolean
|
|
16
|
-
| extendWidth | 下拉框的宽度是否与input一致 | Boolean
|
|
17
|
-
| showArrow | 是否显示下拉按钮 | Boolean
|
|
18
|
-
| change |
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ----------- | ---------------------------------------------------------- | ------------------------------- | ---------- |
|
|
5
|
+
| value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number | - |
|
|
6
|
+
| width | 组件宽度 | String,Number | - |
|
|
7
|
+
| placeholder | 选择框默认文字 | String | 请选择 |
|
|
8
|
+
| disabled | 是否禁用当前项 | Boolean | false |
|
|
9
|
+
| size | 组件尺寸大小,提供`small`,`large`两种尺寸,默认为正常 | String | - |
|
|
10
|
+
| emptyText | 没有数据时展示的提示 | String | '赞无数据' |
|
|
11
|
+
| maxTagCount | 最多展示多少个tag,超出部分以点点点展示 | Number | - |
|
|
12
|
+
| multiple | 是否呈现多选模式 | Boolean | false |
|
|
13
|
+
| loading | 是否显示异步加载 | Boolean | false |
|
|
14
|
+
| clearable | 是否可以清空选项 | Boolean | false |
|
|
15
|
+
| bordered | 是否显示边框 | Boolean | true |
|
|
16
|
+
| extendWidth | 下拉框的宽度是否与input一致 | Boolean | true |
|
|
17
|
+
| showArrow | 是否显示下拉按钮 | Boolean | true |
|
|
18
|
+
| change | 在选项状态发生改变时触发,,返回选择的值value | Function(value) | - |
|
|
19
|
+
| select | 选中一项时触发 | Function({value,label,checked}) | - |
|
|
20
|
+
| openChange | 下拉框展开或收起时触发 | Function | - |
|
|
21
|
+
| options | options 数据,如果设置则不需要手动构造 Option 节点 | Array <{value,label,disabled}> | [] |
|
|
22
|
+
| theme | theme='light' 时呈现浅色主题 | String | - |
|
|
23
|
+
| icon | 自定义图标 | String | - |
|
|
24
|
+
| shape | shape='circle' 时呈现圆角 | String | - |
|
|
24
25
|
|
|
25
26
|
## Option API
|
|
26
27
|
|
|
@@ -29,4 +30,4 @@
|
|
|
29
30
|
| key | 和 value 含义一致。如果 Vue 需要你设置此项,此项值与 value 的值相同,然后可以省略 value 设置 | String,Number | - |
|
|
30
31
|
| value | 选项值,默认根据此属性值进行筛选,必填 | String,Number | - |
|
|
31
32
|
| label | 选项显示的内容 | String,Number | - |
|
|
32
|
-
| disabled | 是否禁用当前项 | Boolean | false |
|
|
33
|
+
| disabled | 是否禁用当前项 | Boolean | false |
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import Icon from "../icon";
|
|
2
2
|
import { Checkmark } from "kui-icons";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
defineComponent,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
} from "vue";
|
|
8
|
+
import { withInstall } from "../utils/vue";
|
|
5
9
|
const Option = defineComponent({
|
|
6
10
|
name: "Option",
|
|
7
11
|
props: {
|
|
@@ -44,4 +48,4 @@ const Option = defineComponent({
|
|
|
44
48
|
};
|
|
45
49
|
},
|
|
46
50
|
});
|
|
47
|
-
export default withInstall(Option);
|
|
51
|
+
export default withInstall(Option);
|