cxselect.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <th:block th:include="include :: header('多级联动下拉')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight">
  8. <div class="row">
  9. <div class="col-sm-12">
  10. <div class="ibox float-e-margins">
  11. <div class="ibox-title">
  12. <h5>多级联动下拉<small>https://github.com/ciaoca/cxSelect</small></h5>
  13. </div>
  14. <div class="ibox-content">
  15. <p>简单联动示例。</p>
  16. <div id="element" class="row">
  17. <div class="col-sm-2">
  18. <select class="type form-control m-b" data-first-title="请选择">
  19. <option value="">请选择</option>
  20. </select>
  21. </div>
  22. <div class="col-sm-2">
  23. <select class="router form-control m-b" data-first-title="请选择">
  24. <option value="">请选择</option>
  25. </select>
  26. </div>
  27. </div>
  28. <hr>
  29. <p>国内省市区联动。</p>
  30. <div id="element1" class="row">
  31. <div class="col-sm-2">
  32. <select class="province form-control m-b" data-first-title="选择省">
  33. <option value="">请选择</option>
  34. <option value="广东省" selected>广东省</option>
  35. </select>
  36. </div>
  37. <div class="col-sm-2">
  38. <select class="city form-control m-b" data-first-title="选择市">
  39. <option value="">请选择</option>
  40. <option value="深圳市" selected>深圳市</option>
  41. </select>
  42. </div>
  43. <div class="col-sm-2">
  44. <select class="area form-control m-b" data-first-title="选择地区">
  45. <option value="">请选择</option>
  46. <option value="南山区" selected>南山区</option>
  47. </select>
  48. </div>
  49. </div>
  50. <hr>
  51. <p>自定义选项。</p>
  52. <div id="element2" class="row">
  53. <div class="col-sm-2">
  54. <select class="first form-control m-b"></select>
  55. </div>
  56. <div class="col-sm-2">
  57. <select class="second form-control m-b"></select>
  58. </div>
  59. <div class="col-sm-2">
  60. <select class="third form-control m-b"></select>
  61. </div>
  62. <div class="col-sm-2">
  63. <select class="fourth form-control m-b"></select>
  64. </div>
  65. <div class="col-sm-2">
  66. <select class="fifth form-control m-b"></select>
  67. </div>
  68. </div>
  69. <hr>
  70. <div class="form-group">
  71. <label class="font-noraml">相关参数详细信息</label>
  72. <div><a href="http://doc.ruoyi.vip/ruoyi/document/zjwd.html#jquery-cxselect" target="_blank">http://doc.ruoyi.vip/ruoyi/document/zjwd.html#jquery-cxselect</a></div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <th:block th:include="include :: footer" />
  80. <th:block th:include="include :: jquery-cxselect-js" />
  81. <script th:inline="javascript">
  82. // 直接返回获取
  83. var data = [[${data}]];
  84. $('#element').cxSelect({
  85. selects: ['type', 'router'],
  86. jsonValue: 'v',
  87. data: data
  88. });
  89. // 通过默认url获取
  90. var urlChina = 'cityData';
  91. $.cxSelect.defaults.url = urlChina;
  92. $('#element1').cxSelect({
  93. selects: ['province', 'city', 'area'],
  94. nodata: 'none'
  95. });
  96. // 固定值获取
  97. $('#element2').cxSelect({
  98. selects: ['first', 'second', 'third', 'fourth', 'fifth'],
  99. required: true,
  100. jsonValue: 'v',
  101. data: [
  102. {'v': '1', 'n': '第一级 >', 's': [
  103. {'v': '2', 'n': '第二级 >', 's': [
  104. {'v': '3', 'n': '第三级 >', 's': [
  105. {'v': '4', 'n': '第四级 >', 's': [
  106. {'v': '5', 'n': '第五级 >', 's': [
  107. {'v': '6', 'n': '第六级 >'}
  108. ]}
  109. ]}
  110. ]}
  111. ]}
  112. ]},
  113. {'v': 'test number', 'n': '测试数字', 's': [
  114. {'v': 'text', 'n': '文本类型', 's': [
  115. {'v': '4', 'n': '4'},
  116. {'v': '5', 'n': '5'},
  117. {'v': '6', 'n': '6'},
  118. {'v': '7', 'n': '7'},
  119. {'v': '8', 'n': '8'},
  120. {'v': '9', 'n': '9'},
  121. {'v': '10', 'n': '10'}
  122. ]},
  123. {'v': 'number', 'n': '数值类型', 's': [
  124. {'v': 11, 'n': 11},
  125. {'v': 12, 'n': 12},
  126. {'v': 13, 'n': 13},
  127. {'v': 14, 'n': 14},
  128. {'v': 15, 'n': 15},
  129. {'v': 16, 'n': 16},
  130. {'v': 17, 'n': 17}
  131. ]}
  132. ]},
  133. {'v': 'test boolean','n': '测试 Boolean 类型', 's': [
  134. {'v': true ,'n': true},
  135. {'v': false ,'n': false}
  136. ]},
  137. {v: 'test quotes', n: '测试属性不加引号', s: [
  138. {v: 'quotes', n: '引号'}
  139. ]},
  140. {v: 'test other', n: '测试奇怪的值', s: [
  141. {v: '[]', n: '数组(空)'},
  142. {v: [1,2,3], n: '数组(数值)'},
  143. {v: ['a','b','c'], n: '数组(文字)'},
  144. {v: new Date(), n: '日期'},
  145. {v: new RegExp('\\d+'), n: '正则对象'},
  146. {v: /\d+/, n: '正则直接量'},
  147. {v: {}, n: '对象'},
  148. {v: document.getElementById('custom_data'), n: 'DOM'},
  149. {v: null, n: 'Null'},
  150. {n: '未设置 value'}
  151. ]},
  152. {'v': '' , 'n': '无子级'}
  153. ]
  154. });
  155. </script>
  156. </body>
  157. </html>