kui-vue 3.6.4 → 3.6.7

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.
Files changed (197) hide show
  1. package/components/alert/alert.jsx +26 -7
  2. package/components/alert/demo/basic.md +4 -4
  3. package/components/alert/demo/icon.md +15 -6
  4. package/components/alert/styles/index.less +42 -14
  5. package/components/avatar/styles/index.less +4 -4
  6. package/components/backtop/styles/index.less +10 -14
  7. package/components/badge/styles/index.less +7 -13
  8. package/components/breadcrumb/index.md +7 -6
  9. package/components/breadcrumb/styles/index.less +7 -21
  10. package/components/button/demo/color.md +0 -1
  11. package/components/button/demo/disabled.md +6 -0
  12. package/components/button/demo/light.md +1 -1
  13. package/components/button/styles/index.less +165 -111
  14. package/components/card/card.jsx +1 -1
  15. package/components/card/demo/basic.md +1 -1
  16. package/components/card/demo/border.md +1 -1
  17. package/components/card/demo/notitle.md +1 -1
  18. package/components/card/styles/index.less +5 -4
  19. package/components/carousel/carousel.jsx +186 -175
  20. package/components/carousel/styles/index.less +11 -16
  21. package/components/checkbox/checkbox.jsx +2 -2
  22. package/components/checkbox/styles/index.less +21 -29
  23. package/components/collapse/styles/index.less +7 -11
  24. package/components/colorPicker/styles/index.less +83 -71
  25. package/components/config/context.js +21 -0
  26. package/components/config/index.js +10 -2
  27. package/components/datePicker/datepicker.jsx +6 -2
  28. package/components/datePicker/styles/index.less +54 -57
  29. package/components/descriptions/styles/index.less +8 -17
  30. package/components/divider/styles/index.less +20 -18
  31. package/components/drawer/demo/target.md +1 -0
  32. package/components/drawer/styles/animal.less +0 -1
  33. package/components/drawer/styles/index.less +8 -11
  34. package/components/dropdown/demo/cascading.md +30 -16
  35. package/components/dropdown/styles/index.less +26 -34
  36. package/components/empty/index.md +3 -2
  37. package/components/empty/styles/index.less +2 -2
  38. package/components/flex/demo/align.md +1 -1
  39. package/components/flex/demo/basic.md +1 -2
  40. package/components/flex/index.md +1 -1
  41. package/components/form/demo/dynamicvalid.md +1 -3
  42. package/components/form/demo/info.md +22 -12
  43. package/components/form/demo/valid.md +6 -6
  44. package/components/form/demo/withmodal.md +6 -6
  45. package/components/form/styles/index.less +10 -11
  46. package/components/grid/index.md +4 -1
  47. package/components/grid/styles/index.less +1 -1
  48. package/components/icon/demo/search.vue +44 -21
  49. package/components/icon/index.md +1 -1
  50. package/components/icon/styles/index.less +7 -8
  51. package/components/image/index.md +7 -1
  52. package/components/image/preview.jsx +17 -4
  53. package/components/image/styles/index.less +36 -42
  54. package/components/index.js +9 -9
  55. package/components/input/demo/icon.md +0 -1
  56. package/components/input/demo/suffix.md +2 -7
  57. package/components/input/input.jsx +31 -29
  58. package/components/input/inputBox.jsx +13 -0
  59. package/components/input/inputGroup.jsx +2 -0
  60. package/components/input/styles/index.less +47 -53
  61. package/components/input/textarea.jsx +1 -1
  62. package/components/inputNumber/demo/basic.md +3 -3
  63. package/components/inputNumber/demo/ffix.md +2 -2
  64. package/components/inputNumber/inputNumber.jsx +2 -2
  65. package/components/inputNumber/styles/index.less +36 -42
  66. package/components/layout/demo/basic.md +5 -5
  67. package/components/layout/demo/info.md +1 -34
  68. package/components/layout/demo/layout1.md +7 -7
  69. package/components/layout/demo/layout2.md +32 -20
  70. package/components/layout/demo/layout3.md +20 -13
  71. package/components/layout/demo/layout4.md +12 -8
  72. package/components/layout/demo/layout5.md +6 -2
  73. package/components/layout/styles/index.less +1 -18
  74. package/components/loading/demo/info.md +3 -3
  75. package/components/loading/styles/index.less +31 -31
  76. package/components/menu/demo/accordion.md +44 -22
  77. package/components/menu/demo/basic.md +35 -20
  78. package/components/menu/demo/collapsed.md +37 -19
  79. package/components/menu/demo/inline.md +44 -23
  80. package/components/menu/demo/mode.md +42 -26
  81. package/components/menu/demo/theme.md +34 -18
  82. package/components/menu/demo/vertical.md +34 -18
  83. package/components/menu/index.md +14 -3
  84. package/components/menu/menu.jsx +9 -3
  85. package/components/menu/menuitem.jsx +4 -4
  86. package/components/menu/recursiveMenu.jsx +40 -0
  87. package/components/menu/styles/index.less +46 -58
  88. package/components/message/demo/basic.md +0 -7
  89. package/components/message/index.js +0 -4
  90. package/components/message/index.md +0 -1
  91. package/components/message/inner.jsx +15 -2
  92. package/components/message/styles/index.less +12 -17
  93. package/components/modal/demo/confirm.md +6 -6
  94. package/components/modal/demo/global.md +0 -15
  95. package/components/modal/demo/info.md +0 -1
  96. package/components/modal/index.js +5 -34
  97. package/components/modal/index.md +1 -2
  98. package/components/modal/modal.jsx +2 -1
  99. package/components/modal/styles/index.less +14 -21
  100. package/components/notice/demo/basic.md +0 -9
  101. package/components/notice/demo/close.md +4 -0
  102. package/components/notice/demo/types.md +1 -2
  103. package/components/notice/index.js +1 -19
  104. package/components/notice/styles/index.less +16 -22
  105. package/components/page/page.jsx +5 -4
  106. package/components/page/styles/index.less +49 -50
  107. package/components/popconfirm/demo/basic.md +11 -18
  108. package/components/popconfirm/demo/info.md +3 -1
  109. package/components/popconfirm/demo/local.md +14 -20
  110. package/components/popconfirm/demo/placement.md +3 -9
  111. package/components/popconfirm/index.md +3 -2
  112. package/components/popconfirm/styles/index.less +9 -15
  113. package/components/poptip/styles/index.less +44 -49
  114. package/components/progress/styles/index.less +13 -13
  115. package/components/radio/index.md +7 -7
  116. package/components/radio/radio.jsx +5 -1
  117. package/components/radio/styles/index.less +26 -32
  118. package/components/rate/index.md +11 -11
  119. package/components/rate/styles/index.less +4 -7
  120. package/components/select/select.jsx +2 -2
  121. package/components/select/styles/index.less +37 -50
  122. package/components/skeleton/index.md +5 -1
  123. package/components/skeleton/styles/index.less +21 -19
  124. package/components/slider/slider.jsx +25 -13
  125. package/components/slider/styles/index.less +13 -12
  126. package/components/space/space.jsx +2 -1
  127. package/components/spin/styles/index.less +25 -40
  128. package/components/statCard/demo/card.md +18 -4
  129. package/components/statCard/index.md +5 -5
  130. package/components/statCard/statCard.jsx +4 -1
  131. package/components/statCard/styles/index.less +9 -6
  132. package/components/styles/less-css-var.less +305 -0
  133. package/components/styles/less-var.less +296 -0
  134. package/components/styles/sys.less +19 -15
  135. package/components/switch/styles/index.less +9 -24
  136. package/components/table/index.md +1 -1
  137. package/components/table/styles/index.less +63 -59
  138. package/components/table/table.jsx +1 -1
  139. package/components/tabs/styles/index.less +22 -24
  140. package/components/tag/demo/basic.md +0 -8
  141. package/components/tag/index.md +2 -1
  142. package/components/tag/styles/index.less +40 -41
  143. package/components/tag/tag.jsx +2 -2
  144. package/components/timeline/styles/index.less +8 -14
  145. package/components/tooltip/styles/index.less +35 -40
  146. package/components/tree/index.md +15 -15
  147. package/components/tree/styles/index.less +36 -56
  148. package/components/tree/tree.jsx +1 -0
  149. package/components/treeselect/index.md +1 -1
  150. package/components/treeselect/styles/index.less +26 -32
  151. package/components/treeselect/treeselect.jsx +3 -3
  152. package/components/upload/demo/forms.md +0 -1
  153. package/components/upload/fileList.jsx +6 -3
  154. package/components/upload/styles/index.less +33 -29
  155. package/components/upload/upload.jsx +5 -1
  156. package/components/utils/vue.js +4 -2
  157. package/dist/k-ui.cjs.js +3 -2
  158. package/dist/k-ui.css +4 -3
  159. package/dist/k-ui.d.ts +71 -54
  160. package/dist/k-ui.esm.js +3 -2
  161. package/dist/k-ui.umd.js +3 -2
  162. package/dist/locale/de.js +2 -1
  163. package/dist/locale/el.js +2 -1
  164. package/dist/locale/en.js +2 -1
  165. package/dist/locale/fr.js +2 -1
  166. package/dist/locale/it.js +2 -1
  167. package/dist/locale/ja.js +2 -1
  168. package/dist/locale/ko.js +2 -1
  169. package/dist/locale/ru.js +2 -1
  170. package/dist/locale/th.js +2 -1
  171. package/dist/locale/uk.js +2 -1
  172. package/dist/locale/vi.js +2 -1
  173. package/dist/locale/zh-CN.js +2 -1
  174. package/dist/locale/zh-TW.js +2 -1
  175. package/package.json +14 -16
  176. package/types/alert/Alert.d.ts +2 -0
  177. package/types/card/Card.d.ts +1 -1
  178. package/types/checkbox/Checkbox.d.ts +1 -0
  179. package/types/datePicker/DatePicker.d.ts +1 -0
  180. package/types/index.d.ts +6 -6
  181. package/types/input/Input.d.ts +1 -0
  182. package/types/input/InputGroup.d.ts +2 -0
  183. package/types/input/TextArea.d.ts +1 -0
  184. package/types/inputNumber/InputNumber.d.ts +1 -0
  185. package/types/menu/Menu.d.ts +1 -0
  186. package/types/page/Page.d.ts +1 -0
  187. package/types/select/Select.d.ts +1 -0
  188. package/types/statCard/StatCard.d.ts +2 -0
  189. package/types/table/Table.d.ts +1 -1
  190. package/types/tag/Tag.d.ts +1 -0
  191. package/types/treeselect/TreeSelect.d.ts +1 -0
  192. package/components/dropdown/demo/custom.md +0 -31
  193. package/components/icon/lib/dist.json +0 -1
  194. package/components/icon/lib/kui-icons.js +0 -1
  195. package/components/icon/lib/sprite.svg +0 -1
  196. package/components/styles/color.less +0 -209
  197. package/components/styles/var.less +0 -207
@@ -11,28 +11,8 @@
11
11
  :openKeys="openKeys"
12
12
  mode="inline"
13
13
  @openChange="openChange"
14
- >
15
- <SubMenu key="sub1" :icon="Mail" title="Navigation One">
16
- <MenuItem key="1-1" :icon="Heart">Option 1</MenuItem>
17
- <MenuItem key="1-2" :icon="Heart">Option 2</MenuItem>
18
- <MenuItem key="1-3" :icon="Heart">Option 3</MenuItem>
19
- <MenuItem key="1-4" :icon="Heart">Option 4</MenuItem>
20
- </SubMenu>
21
- <SubMenu key="sub2" :icon="Heart" title="Navigation Two">
22
- <MenuItem key="2-1">Option 5</MenuItem>
23
- <MenuItem key="2-2">Option 6</MenuItem>
24
- <SubMenu key="sub2-1" title="SubMenu">
25
- <MenuItem key="2-3">Option 7</MenuItem>
26
- <MenuItem key="2-4">Option 8</MenuItem>
27
- </SubMenu>
28
- </SubMenu>
29
- <SubMenu key="sub3" :icon="Settings" title="Navigation Three">
30
- <MenuItem key="3-1">Option 9</MenuItem>
31
- <MenuItem key="3-2">Option 10</MenuItem>
32
- <MenuItem key="3-3">Option 11</MenuItem>
33
- <MenuItem key="3-4">Option 12</MenuItem>
34
- </SubMenu>
35
- </Menu>
14
+ :items="items"
15
+ />
36
16
  </div>
37
17
  </template>
38
18
  <script setup>
@@ -42,6 +22,47 @@ const current = ref(["1-1"]);
42
22
  const openKeys = ref(["sub1"]);
43
23
  const openChange = (openKeys) => {
44
24
  console.log(openKeys);
45
- }
25
+ };
26
+ const items = [
27
+ {
28
+ key: "sub1",
29
+ icon: Mail,
30
+ title: "Navigation One",
31
+ children: [
32
+ { key: "1-1", icon: Heart, title: "Option " },
33
+ { key: "1-2", icon: Heart, title: "Option 2" },
34
+ { key: "1-3", icon: Heart, title: "Option 3" },
35
+ { key: "1-4", icon: Heart, title: "Option 4" },
36
+ ],
37
+ },
38
+ {
39
+ key: "sub2",
40
+ icon: Heart,
41
+ title: "Navigation Two",
42
+ children: [
43
+ { key: "2-1", title: "Option 5" },
44
+ { key: "2-2", title: "Option 6" },
45
+ {
46
+ key: "sub2-1",
47
+ title: "SubMenu",
48
+ children: [
49
+ { key: "2-3", title: "Option 7" },
50
+ { key: "2-4", title: "Option 8" },
51
+ ],
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ key: "sub3",
57
+ icon: Settings,
58
+ title: "Navigation Three",
59
+ children: [
60
+ { key: "3-1", title: "Option 9" },
61
+ { key: "3-2", title: "Option 10" },
62
+ { key: "3-3", title: "Option 11" },
63
+ { key: "3-4", title: "Option 12" },
64
+ ],
65
+ },
66
+ ];
46
67
  </script>
47
68
  ```
@@ -6,9 +6,10 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div>
9
- <KSwitch @change="changeMode" v-model="checked" /> Change Mode
10
- <KSwitch true-text="dark" false-text="light" @change="changeTheme" /> Change
11
- Theme
9
+ <Space>
10
+ <Button @click="changeMode">Change Mode</Button>
11
+ <Button @click="changeTheme"> Change Theme </Button>
12
+ </Space>
12
13
  <br />
13
14
  <br />
14
15
  <Menu
@@ -17,24 +18,8 @@
17
18
  :theme="theme"
18
19
  :mode="mode"
19
20
  style="width:256px"
20
- >
21
- <MenuItem key="1-1" :icon="Mail">Option 1</MenuItem>
22
- <MenuItem key="1-2" :icon="Grid"><span>Option 2</span></MenuItem>
23
- <SubMenu key="sub2" :icon="Heart" title="Navigation Two">
24
- <MenuItem key="2-1">Option 5</MenuItem>
25
- <MenuItem key="2-2">Option 6</MenuItem>
26
- <SubMenu key="sub2-1" title="SubMenu">
27
- <MenuItem key="2-3">Option 7</MenuItem>
28
- <MenuItem key="2-4">Option 8</MenuItem>
29
- </SubMenu>
30
- </SubMenu>
31
- <SubMenu key="sub3" :icon="Settings" title="Navigation Three">
32
- <MenuItem key="3-1">Option 9</MenuItem>
33
- <MenuItem key="3-2">Option 10</MenuItem>
34
- <MenuItem key="3-3">Option 11</MenuItem>
35
- <MenuItem key="3-4">Option 12</MenuItem>
36
- </SubMenu>
37
- </Menu>
21
+ :items="items"
22
+ />
38
23
  </div>
39
24
  </template>
40
25
  <script setup>
@@ -44,13 +29,44 @@ const current = ref(["1-1"]);
44
29
  const openKeys = ref(["sub2"]);
45
30
  const mode = ref("inline");
46
31
  const theme = ref("light");
47
- const checked = ref(false);
48
32
 
49
- const changeMode = (checked) => {
50
- mode.value = checked ? "vertical" : "inline";
33
+ const changeMode = () => {
34
+ mode.value = mode.value == "inline" ? "vertical" : "inline";
51
35
  };
52
- const changeTheme = (checked) => {
53
- theme.value = checked ? "dark" : "light";
36
+ const changeTheme = () => {
37
+ theme.value = theme.value == "light" ? "dark" : "light";
54
38
  };
39
+ const items = [
40
+ { key: "1-1", icon: Mail, title: "Option 1" },
41
+ { key: "1-2", icon: Grid, title: "Option 2" },
42
+ {
43
+ key: "sub2",
44
+ icon: Heart,
45
+ title: "Navigation Two",
46
+ children: [
47
+ { key: "2-1", title: "Option 5" },
48
+ { key: "2-2", title: "Option 6" },
49
+ {
50
+ key: "sub2-1",
51
+ title: "SubMenu",
52
+ children: [
53
+ { key: "2-3", title: "Option 7" },
54
+ { key: "2-4", title: "Option 8" },
55
+ ],
56
+ },
57
+ ],
58
+ },
59
+ {
60
+ key: "sub3",
61
+ icon: Settings,
62
+ title: "Navigation Three",
63
+ children: [
64
+ { key: "3-1", title: "Option 9" },
65
+ { key: "3-2", title: "Option 10" },
66
+ { key: "3-3", title: "Option 11" },
67
+ { key: "3-4", title: "Option 12" },
68
+ ],
69
+ },
70
+ ];
55
71
  </script>
56
72
  ```
@@ -19,24 +19,8 @@
19
19
  :openKeys="openKeys"
20
20
  :theme="theme"
21
21
  mode="inline"
22
- >
23
- <MenuItem key="1-1" :icon="Mail">Option 1</MenuItem>
24
- <MenuItem key="1-2" :icon="Grid">Option 2</MenuItem>
25
- <SubMenu key="sub2" :icon="Heart" title="Navigation Two">
26
- <MenuItem key="2-1">Option 5</MenuItem>
27
- <MenuItem key="2-2">Option 6</MenuItem>
28
- <SubMenu key="sub2-1" title="SubMenu">
29
- <MenuItem key="2-3">Option 7</MenuItem>
30
- <MenuItem key="2-4">Option 8</MenuItem>
31
- </SubMenu>
32
- </SubMenu>
33
- <SubMenu key="sub3" :icon="Settings" title="Navigation Three">
34
- <MenuItem key="3-1">Option 9</MenuItem>
35
- <MenuItem key="3-2">Option 10</MenuItem>
36
- <MenuItem key="3-3">Option 11</MenuItem>
37
- <MenuItem key="3-4">Option 12</MenuItem>
38
- </SubMenu>
39
- </Menu>
22
+ :items="items"
23
+ />
40
24
  </div>
41
25
  </template>
42
26
  <script setup>
@@ -49,5 +33,37 @@ const theme = ref("dark");
49
33
  const change = (checked) => {
50
34
  theme.value = checked ? "dark" : "light";
51
35
  };
36
+ const items = [
37
+ { key: "1-1", icon: Mail, title: "Option 1" },
38
+ { key: "1-2", icon: Grid, title: "Option 2" },
39
+ {
40
+ key: "sub2",
41
+ icon: Heart,
42
+ title: "Navigation Two",
43
+ children: [
44
+ { key: "2-1", title: "Option 5" },
45
+ { key: "2-2", title: "Option 6" },
46
+ {
47
+ key: "sub2-1",
48
+ title: "SubMenu",
49
+ children: [
50
+ { key: "2-3", title: "Option 7" },
51
+ { key: "2-4", title: "Option 8" },
52
+ ],
53
+ },
54
+ ],
55
+ },
56
+ {
57
+ key: "sub3",
58
+ icon: Settings,
59
+ title: "Navigation Three",
60
+ children: [
61
+ { key: "3-1", title: "Option 9" },
62
+ { key: "3-2", title: "Option 10" },
63
+ { key: "3-3", title: "Option 11" },
64
+ { key: "3-4", title: "Option 12" },
65
+ ],
66
+ },
67
+ ];
52
68
  </script>
53
69
  ```
@@ -6,29 +6,45 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div style="width:256px">
9
- <Menu v-model="current" mode="vertical">
10
- <MenuItem key="1-1" :icon="Mail">Option 1</MenuItem>
11
- <MenuItem key="1-2" :icon="Grid">Option 2</MenuItem>
12
- <SubMenu key="sub2" :icon="Heart" title="Navigation Two">
13
- <MenuItem key="2-1">Option 5</MenuItem>
14
- <MenuItem key="2-2">Option 6</MenuItem>
15
- <SubMenu key="sub2-1" title="SubMenu">
16
- <MenuItem key="2-3">Option 7</MenuItem>
17
- <MenuItem key="2-4">Option 8</MenuItem>
18
- </SubMenu>
19
- </SubMenu>
20
- <SubMenu key="sub3" :icon="Settings" title="Navigation Three">
21
- <MenuItem key="3-1">Option 9</MenuItem>
22
- <MenuItem key="3-2">Option 10</MenuItem>
23
- <MenuItem key="3-3">Option 11</MenuItem>
24
- <MenuItem key="3-4">Option 12</MenuItem>
25
- </SubMenu>
26
- </Menu>
9
+ <Menu v-model="current" mode="vertical" :items="items" />
27
10
  </div>
28
11
  </template>
29
12
  <script setup>
30
13
  import { ref } from "vue";
31
14
  import { Mail, Grid, Heart, Settings } from "kui-icons";
32
15
  const current = ref(["1-1"]);
16
+
17
+ const items = [
18
+ { key: "1-1", icon: Mail, title: "Option 1" },
19
+ { key: "1-2", icon: Grid, title: "Option 2" },
20
+ {
21
+ key: "sub2",
22
+ icon: Heart,
23
+ title: "Navigation Two",
24
+ children: [
25
+ { key: "2-1", title: "Option 5" },
26
+ { key: "2-2", title: "Option 6" },
27
+ {
28
+ key: "sub2-1",
29
+ title: "SubMenu",
30
+ children: [
31
+ { key: "2-3", title: "Option 7" },
32
+ { key: "2-4", title: "Option 8" },
33
+ ],
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ key: "sub3",
39
+ icon: Settings,
40
+ title: "Navigation Three",
41
+ children: [
42
+ { key: "3-1", title: "Option 9" },
43
+ { key: "3-2", title: "Option 10" },
44
+ { key: "3-3", title: "Option 11" },
45
+ { key: "3-4", title: "Option 12" },
46
+ ],
47
+ },
48
+ ];
33
49
  </script>
34
50
  ```
@@ -6,6 +6,7 @@
6
6
  | -------------------- | ---------------------------------------- | ------------------------------------------------- | -------- |
7
7
  | value(v-model) | 当前选中的菜单项 | String: [] | light |
8
8
  | theme | 主题颜色 | String: light dark | light |
9
+ | items | 菜单数据 | Array | - |
9
10
  | v-model:openKeys | 当前展开的 SubMenu 菜单项 key 数组 | String[] | - |
10
11
  | v-model:selectedKeys | 当前选中的菜单项,可使用 v-model 绑定 | String[] | - |
11
12
  | mode | 菜单类型,支持垂直、水平、和内嵌模式三种 | String: vertical vertical-right horizontal inline | vertical |
@@ -14,7 +15,7 @@
14
15
  | accordion | 是否只允许菜单展开一项 | Boolean | false |
15
16
  | inline-collapsed | inline 时菜单是否收起状态 | Boolean | false |
16
17
 
17
- ### Menu.Item
18
+ ### Menu(items)
18
19
 
19
20
  | 属性 | 说明 | 类型 | 默认值 |
20
21
  | -------- | ------------------------ | ------- | ------ |
@@ -22,8 +23,18 @@
22
23
  | disabled | 是否禁用 | Boolean | false |
23
24
  | key | item 的唯一标志 | String | - |
24
25
  | title | 设置收缩时展示的悬浮标题 | String | - |
26
+ | children | 菜单子集 | Array | - |
25
27
 
26
- ### Menu.SubMenu
28
+ ### MenuItem
29
+
30
+ | 属性 | 说明 | 类型 | 默认值 |
31
+ | -------- | ------------------------ | ------- | ------ |
32
+ | icon | item 的图标 | String | - |
33
+ | disabled | 是否禁用 | Boolean | false |
34
+ | key | item 的唯一标志 | String | - |
35
+ | title | 设置收缩时展示的悬浮标题 | String | - |
36
+
37
+ ### SubMenu
27
38
 
28
39
  | 属性 | 说明 | 类型 | 默认值 |
29
40
  | -------- | --------------- | ------------ | ------ |
@@ -32,7 +43,7 @@
32
43
  | key | item 的唯一标志 | String | - |
33
44
  | title | 子菜单项值 | String,slots | - |
34
45
 
35
- ### Menu.MenuGroup
46
+ ### MenuGroup
36
47
 
37
48
  | 属性 | 说明 | 类型 | 默认值 |
38
49
  | ----- | -------- | ------------ | ------ |
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, watch, provide, inject, onMounted } from "vue";
2
2
  import { withInstall } from "../utils/vue";
3
-
3
+ import RecursiveMenu from "./recursiveMenu";
4
4
  const Menu = defineComponent({
5
5
  name: "Menu",
6
6
  props: {
@@ -9,6 +9,7 @@ const Menu = defineComponent({
9
9
  value: { type: Array, default: () => [] },
10
10
  // selectedKeys: { type: Array, default: () => [] }, // for 3
11
11
  accordion: Boolean,
12
+ items: Array,
12
13
  inlineCollapsed: Boolean,
13
14
  openKeys: { type: Array, default: () => [] },
14
15
  },
@@ -116,7 +117,8 @@ const Menu = defineComponent({
116
117
  provide("selectedKeysChange", selectedKeysChange);
117
118
 
118
119
  return () => {
119
- const preCls = dropdown ? "dropdown-menu" : "menu";
120
+ const preCls = dropdown ? "dropdown-menu k-scroll" : "menu";
121
+ const { items } = props;
120
122
  const cls = [
121
123
  `k-${preCls} k-${preCls}-${currentMode.value}`,
122
124
  {
@@ -125,7 +127,11 @@ const Menu = defineComponent({
125
127
  ];
126
128
  return (
127
129
  <ul class={cls} theme-mode={props.theme}>
128
- {slots.default?.()}
130
+ {items && items.length
131
+ ? items.map((item) => {
132
+ return <RecursiveMenu item={item} key={item.key} />;
133
+ })
134
+ : slots.default?.()}
129
135
  </ul>
130
136
  );
131
137
  };
@@ -1,6 +1,6 @@
1
1
  import Icon from "../icon";
2
2
  import { getChildren } from "../utils/vnode";
3
- import { withInstall } from '../utils/vue';
3
+ import { withInstall } from "../utils/vue";
4
4
  import {
5
5
  defineComponent,
6
6
  ref,
@@ -53,8 +53,8 @@ const MenuItem = defineComponent({
53
53
  style: {
54
54
  paddingLeft:
55
55
  (mode.value == "inline" || mode.value == "vertical") &&
56
- keyPah.length &&
57
- !ps.isPopup
56
+ keyPah.length &&
57
+ !ps.isPopup
58
58
  ? `${keyPah.length * 16 + 16}px`
59
59
  : null,
60
60
  },
@@ -83,7 +83,7 @@ const MenuItem = defineComponent({
83
83
  if (disabled) return;
84
84
  selectedKeysChange?.(key, true, keyPah);
85
85
  },
86
- }
86
+ },
87
87
  };
88
88
 
89
89
  // 没有子集的时候才展示
@@ -0,0 +1,40 @@
1
+ import RecursiveSubMenu from "./recursiveMenu.jsx";
2
+ import SubMenu from "./submenu.jsx";
3
+ import MenuItem from "./menuitem.jsx";
4
+ import { defineComponent } from "vue";
5
+ const RecursiveMenu = defineComponent({
6
+ name: "RecursiveMenu",
7
+ props: {
8
+ item: Object,
9
+ isPopup: Boolean,
10
+ },
11
+ setup(props) {
12
+ return () => {
13
+ const { item } = props;
14
+ return item.children && item.children.length > 0 ? (
15
+ <SubMenu
16
+ key={item.key}
17
+ isPopup={props.isPopup}
18
+ title={item.title}
19
+ icon={item.icon}
20
+ disabled={item.disabled}
21
+ >
22
+ {item.children.map((child) => {
23
+ return <RecursiveSubMenu item={child} key={child.key} />;
24
+ })}
25
+ </SubMenu>
26
+ ) : (
27
+ <MenuItem
28
+ key={item.key}
29
+ isPopup={props.isPopup}
30
+ icon={item.icon}
31
+ disabled={item.disabled}
32
+ >
33
+ {item.title}
34
+ </MenuItem>
35
+ );
36
+ };
37
+ },
38
+ });
39
+
40
+ export default RecursiveMenu;