multiple-selection.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="example-block">
  3. <span class="example-demonstration">Display all tags (default)</span>
  4. <el-cascader :options="options" :props="props" clearable />
  5. </div>
  6. <div class="example-block">
  7. <span class="example-demonstration">Collapse tags</span>
  8. <el-cascader :options="options" :props="props" collapse-tags clearable />
  9. </div>
  10. <div class="example-block">
  11. <span class="example-demonstration">Collapse tags tooltip</span>
  12. <el-cascader :options="options" :props="props" collapse-tags collapse-tags-tooltip clearable />
  13. </div>
  14. </template>
  15. <script lang="ts" setup>
  16. const props = { multiple: true }
  17. const options = [
  18. {
  19. value: 1,
  20. label: 'Asia',
  21. children: [
  22. {
  23. value: 2,
  24. label: 'China',
  25. children: [
  26. { value: 3, label: 'Beijing' },
  27. { value: 4, label: 'Shanghai' },
  28. { value: 5, label: 'Hangzhou' },
  29. ],
  30. },
  31. {
  32. value: 6,
  33. label: 'Japan',
  34. children: [
  35. { value: 7, label: 'Tokyo' },
  36. { value: 8, label: 'Osaka' },
  37. { value: 9, label: 'Kyoto' },
  38. ],
  39. },
  40. {
  41. value: 10,
  42. label: 'Korea',
  43. children: [
  44. { value: 11, label: 'Seoul' },
  45. { value: 12, label: 'Busan' },
  46. { value: 13, label: 'Taegu' },
  47. ],
  48. },
  49. ],
  50. },
  51. {
  52. value: 14,
  53. label: 'Europe',
  54. children: [
  55. {
  56. value: 15,
  57. label: 'France',
  58. children: [
  59. { value: 16, label: 'Paris' },
  60. { value: 17, label: 'Marseille' },
  61. { value: 18, label: 'Lyon' },
  62. ],
  63. },
  64. {
  65. value: 19,
  66. label: 'UK',
  67. children: [
  68. { value: 20, label: 'London' },
  69. { value: 21, label: 'Birmingham' },
  70. { value: 22, label: 'Manchester' },
  71. ],
  72. },
  73. ],
  74. },
  75. {
  76. value: 23,
  77. label: 'North America',
  78. children: [
  79. {
  80. value: 24,
  81. label: 'US',
  82. children: [
  83. { value: 25, label: 'New York' },
  84. { value: 26, label: 'Los Angeles' },
  85. { value: 27, label: 'Washington' },
  86. ],
  87. },
  88. {
  89. value: 28,
  90. label: 'Canada',
  91. children: [
  92. { value: 29, label: 'Toronto' },
  93. { value: 30, label: 'Montreal' },
  94. { value: 31, label: 'Ottawa' },
  95. ],
  96. },
  97. ],
  98. },
  99. ]
  100. </script>
  101. <style scoped>
  102. .example-block {
  103. margin: 1rem;
  104. }
  105. .example-demonstration {
  106. margin: 1rem;
  107. }
  108. </style>