messagePush.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view class="padding-sm">
  3. <form action="">
  4. <checkbox-group class="block" @change="CheckboxChange">
  5. <view class=" margin-top ">
  6. <view class="flex align-center checkItems">
  7. <checkbox class="blue" :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  8. <view class="title">电力监测</view>
  9. </view>
  10. <view class="flex align-center checkItems">
  11. <checkbox class="blue" :class="checkbox[1].checked?'checked':''" :checked="checkbox[1].checked?true:false" value="B"></checkbox>
  12. <view class="title">视频报警</view>
  13. </view>
  14. </view>
  15. </checkbox-group>
  16. <view class="btn-area submitBottomBtn padding-lr-sm">
  17. <button class="bg-blue round margin-top">提 交 </button>
  18. </view>
  19. </form>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. checkbox: [{
  27. value: 'A',
  28. checked: false
  29. },
  30. {
  31. value: 'B',
  32. checked: false
  33. },
  34. {
  35. value: 'C',
  36. checked: false
  37. },
  38. {
  39. value: 'D',
  40. checked: false
  41. },
  42. {
  43. value: 'E',
  44. checked: false
  45. },
  46. {
  47. value: 'F',
  48. checked: false
  49. },
  50. {
  51. value: 'G',
  52. checked: false
  53. },
  54. {
  55. value: 'H',
  56. checked: false
  57. }
  58. ],
  59. }
  60. },
  61. methods: {
  62. CheckboxChange(e) {
  63. var items = this.checkbox,
  64. values = e.detail.value;
  65. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  66. items[i].checked = false;
  67. for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
  68. if (items[i].value == values[j]) {
  69. items[i].checked = true;
  70. break
  71. }
  72. }
  73. }
  74. },
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .checkItems {
  80. width: 50%;
  81. display: inline-block;
  82. text-align: center;
  83. margin-bottom: 40rpx;
  84. .title {
  85. display: inline-block;
  86. margin-left: 10rpx;
  87. }
  88. }
  89. </style>