basic.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="m-4">
  3. <p>Child options expand when clicked (default)</p>
  4. <el-cascader v-model="value" :options="options" @change="handleChange" />
  5. </div>
  6. <div class="m-4">
  7. <p>Child options expand when hovered</p>
  8. <el-cascader
  9. v-model="value"
  10. :options="options"
  11. :props="props"
  12. @change="handleChange"
  13. />
  14. </div>
  15. </template>
  16. <script lang="ts" setup>
  17. import { ref } from 'vue'
  18. const value = ref([])
  19. const props = {
  20. expandTrigger: 'hover' as const,
  21. }
  22. const handleChange = (value) => {
  23. console.log(value)
  24. }
  25. const options = [
  26. {
  27. value: 'guide',
  28. label: 'Guide',
  29. children: [
  30. {
  31. value: 'disciplines',
  32. label: 'Disciplines',
  33. children: [
  34. {
  35. value: 'consistency',
  36. label: 'Consistency',
  37. },
  38. {
  39. value: 'feedback',
  40. label: 'Feedback',
  41. },
  42. {
  43. value: 'efficiency',
  44. label: 'Efficiency',
  45. },
  46. {
  47. value: 'controllability',
  48. label: 'Controllability',
  49. },
  50. ],
  51. },
  52. {
  53. value: 'navigation',
  54. label: 'Navigation',
  55. children: [
  56. {
  57. value: 'side nav',
  58. label: 'Side Navigation',
  59. },
  60. {
  61. value: 'top nav',
  62. label: 'Top Navigation',
  63. },
  64. ],
  65. },
  66. ],
  67. },
  68. {
  69. value: 'component',
  70. label: 'Component',
  71. children: [
  72. {
  73. value: 'basic',
  74. label: 'Basic',
  75. children: [
  76. {
  77. value: 'layout',
  78. label: 'Layout',
  79. },
  80. {
  81. value: 'color',
  82. label: 'Color',
  83. },
  84. {
  85. value: 'typography',
  86. label: 'Typography',
  87. },
  88. {
  89. value: 'icon',
  90. label: 'Icon',
  91. },
  92. {
  93. value: 'button',
  94. label: 'Button',
  95. },
  96. ],
  97. },
  98. {
  99. value: 'form',
  100. label: 'Form',
  101. children: [
  102. {
  103. value: 'radio',
  104. label: 'Radio',
  105. },
  106. {
  107. value: 'checkbox',
  108. label: 'Checkbox',
  109. },
  110. {
  111. value: 'input',
  112. label: 'Input',
  113. },
  114. {
  115. value: 'input-number',
  116. label: 'InputNumber',
  117. },
  118. {
  119. value: 'select',
  120. label: 'Select',
  121. },
  122. {
  123. value: 'cascader',
  124. label: 'Cascader',
  125. },
  126. {
  127. value: 'switch',
  128. label: 'Switch',
  129. },
  130. {
  131. value: 'slider',
  132. label: 'Slider',
  133. },
  134. {
  135. value: 'time-picker',
  136. label: 'TimePicker',
  137. },
  138. {
  139. value: 'date-picker',
  140. label: 'DatePicker',
  141. },
  142. {
  143. value: 'datetime-picker',
  144. label: 'DateTimePicker',
  145. },
  146. {
  147. value: 'upload',
  148. label: 'Upload',
  149. },
  150. {
  151. value: 'rate',
  152. label: 'Rate',
  153. },
  154. {
  155. value: 'form',
  156. label: 'Form',
  157. },
  158. ],
  159. },
  160. {
  161. value: 'data',
  162. label: 'Data',
  163. children: [
  164. {
  165. value: 'table',
  166. label: 'Table',
  167. },
  168. {
  169. value: 'tag',
  170. label: 'Tag',
  171. },
  172. {
  173. value: 'progress',
  174. label: 'Progress',
  175. },
  176. {
  177. value: 'tree',
  178. label: 'Tree',
  179. },
  180. {
  181. value: 'pagination',
  182. label: 'Pagination',
  183. },
  184. {
  185. value: 'badge',
  186. label: 'Badge',
  187. },
  188. ],
  189. },
  190. {
  191. value: 'notice',
  192. label: 'Notice',
  193. children: [
  194. {
  195. value: 'alert',
  196. label: 'Alert',
  197. },
  198. {
  199. value: 'loading',
  200. label: 'Loading',
  201. },
  202. {
  203. value: 'message',
  204. label: 'Message',
  205. },
  206. {
  207. value: 'message-box',
  208. label: 'MessageBox',
  209. },
  210. {
  211. value: 'notification',
  212. label: 'Notification',
  213. },
  214. ],
  215. },
  216. {
  217. value: 'navigation',
  218. label: 'Navigation',
  219. children: [
  220. {
  221. value: 'menu',
  222. label: 'Menu',
  223. },
  224. {
  225. value: 'tabs',
  226. label: 'Tabs',
  227. },
  228. {
  229. value: 'breadcrumb',
  230. label: 'Breadcrumb',
  231. },
  232. {
  233. value: 'dropdown',
  234. label: 'Dropdown',
  235. },
  236. {
  237. value: 'steps',
  238. label: 'Steps',
  239. },
  240. ],
  241. },
  242. {
  243. value: 'others',
  244. label: 'Others',
  245. children: [
  246. {
  247. value: 'dialog',
  248. label: 'Dialog',
  249. },
  250. {
  251. value: 'tooltip',
  252. label: 'Tooltip',
  253. },
  254. {
  255. value: 'popover',
  256. label: 'Popover',
  257. },
  258. {
  259. value: 'card',
  260. label: 'Card',
  261. },
  262. {
  263. value: 'carousel',
  264. label: 'Carousel',
  265. },
  266. {
  267. value: 'collapse',
  268. label: 'Collapse',
  269. },
  270. ],
  271. },
  272. ],
  273. },
  274. {
  275. value: 'resource',
  276. label: 'Resource',
  277. children: [
  278. {
  279. value: 'axure',
  280. label: 'Axure Components',
  281. },
  282. {
  283. value: 'sketch',
  284. label: 'Sketch Templates',
  285. },
  286. {
  287. value: 'docs',
  288. label: 'Design Documentation',
  289. },
  290. ],
  291. },
  292. ]
  293. </script>