basic.vue 8.4 KB

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