onoffBtnDemo.jsp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <%@ page language="java" pageEncoding="UTF-8" isELIgnored="false" %>
  2. <%@ taglib uri="/ssTag" prefix="ss"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta http-equiv="pragma" content="no-cache">
  7. <meta http-equiv="cache-control" content="no-cache">
  8. <meta http-equiv="expires" content="0">
  9. <script type="text/javascript" src="/ss/jquery/jquery.js"></script>
  10. <script src="/js/load.js"></script>
  11. <script type="text/javascript" src="/js/display.js"></script>
  12. <script type="text/javascript" src="/js/form.js"></script>
  13. <script>
  14. window.ss = window.ss || {};
  15. window.ss.dom = window.ss.dom || {};
  16. window.ss.dom.formElemConfig = window.ss.dom.formElemConfig || {};
  17. </script>
  18. <style>
  19. body {
  20. margin: 0;
  21. padding: 24px;
  22. background: #f7f8fa;
  23. box-sizing: border-box;
  24. }
  25. .demo-card {
  26. background: #fff;
  27. border: 1px solid #e5e6eb;
  28. border-radius: 8px;
  29. padding: 24px;
  30. }
  31. .demo-title {
  32. font-size: 18px;
  33. font-weight: 600;
  34. margin-bottom: 8px;
  35. }
  36. .demo-desc {
  37. color: #666;
  38. margin-bottom: 20px;
  39. }
  40. .demo-row {
  41. display: flex;
  42. align-items: flex-start;
  43. margin-bottom: 16px;
  44. }
  45. .demo-label {
  46. width: 120px;
  47. line-height: 32px;
  48. color: #333;
  49. flex-shrink: 0;
  50. }
  51. .demo-value {
  52. line-height: 32px;
  53. color: #1677ff;
  54. font-weight: 600;
  55. }
  56. .demo-onoff-group {
  57. display: flex;
  58. flex-wrap: wrap;
  59. gap: 12px;
  60. }
  61. .demo-actions {
  62. margin-top: 24px;
  63. }
  64. .demo-submit {
  65. min-width: 96px;
  66. height: 34px;
  67. border: none;
  68. border-radius: 4px;
  69. background: #1677ff;
  70. color: #fff;
  71. cursor: pointer;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. <form id="app" method="post">
  77. <div class="demo-card">
  78. <div class="demo-title">SsOnoff 单选按钮 Demo</div>
  79. <div class="demo-desc">
  80. 后端需提供:onoffBtnList(code、desc)以及 grczlbm(当前选中值)
  81. </div>
  82. <div class="demo-row">
  83. <div class="demo-label">当前值</div>
  84. <div class="demo-value">{{ grczlbm || '未选择' }}</div>
  85. </div>
  86. <div class="demo-row">
  87. <div class="demo-label">操作类别</div>
  88. <div class="demo-onoff-group">
  89. <ss-onoff
  90. v-for="item in onoffBtnList"
  91. :key="item.code"
  92. name="grczlbm"
  93. v-model="grczlbm"
  94. :label="item.desc"
  95. :value="item.code"
  96. width="120px"
  97. :null="false"
  98. ></ss-onoff>
  99. </div>
  100. </div>
  101. <div class="demo-actions">
  102. <button class="demo-submit" type="submit">提交</button>
  103. </div>
  104. </div>
  105. </form>
  106. </body>
  107. </html>
  108. <script type="module">
  109. const data = {
  110. grczlbm: "${grczlbm}",
  111. onoffBtnList: "${onoffBtnList}" : []
  112. };
  113. SS.ready(function () {
  114. window.SS.dom.initializeFormApp({
  115. el: "#app",
  116. data() {
  117. return data;
  118. }
  119. });
  120. });
  121. </script>