change.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="container">
  3. <view class="body">
  4. <!-- 每一个小孩区域 -->
  5. <view class="body_box" v-for="item in list" :key="item.id" @click="change(item)">
  6. <radio class="box_radio" :checked="item.isCheck" color="#1E7DFB" />
  7. <view class="box_info">
  8. <view class="">{{ item.name }}</view>
  9. <view class="">{{ item.number }}</view>
  10. </view>
  11. </view>
  12. <!-- 确认按钮区域 -->
  13. <view class="body_btn">确认</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { ref } from 'vue'
  19. import { onLoad } from '@dcloudio/uni-app'
  20. onLoad(() => {})
  21. // 小孩列表数据
  22. const list = ref([
  23. { id: 1, name: '张三', number: '26105615262', isCheck: false },
  24. { id: 2, name: '李四', number: '26105615262', isCheck: false },
  25. { id: 3, name: '王五', number: '26105615262', isCheck: false }
  26. ])
  27. const change = (item) => {
  28. list.value.forEach((ele) => {
  29. ele.isCheck = false
  30. })
  31. item.isCheck = !item.isCheck
  32. }
  33. </script>
  34. <style lang="scss" scoped>
  35. .container {
  36. display: flex;
  37. flex-direction: column;
  38. min-height: 100vh;
  39. background-color: #f1f6fe;
  40. .body {
  41. padding-left: 20rpx;
  42. margin-top: 20rpx;
  43. height: calc(100vh - 20rpx);
  44. background-color: #fff;
  45. .body_box {
  46. display: flex;
  47. align-items: center;
  48. height: 170rpx;
  49. border-bottom: 1rpx solid #e6e6e6;
  50. .box_radio {
  51. margin-left: 20rpx;
  52. }
  53. .box_info {
  54. display: flex;
  55. flex-direction: column;
  56. justify-content: space-between;
  57. margin-left: 40rpx;
  58. height: 95rpx;
  59. }
  60. }
  61. .body_btn {
  62. margin: auto;
  63. margin-top: 400rpx;
  64. display: flex;
  65. justify-content: center;
  66. align-items: center;
  67. width: 297rpx;
  68. height: 100rpx;
  69. color: #fff;
  70. font-size: 32rpx;
  71. border-radius: 8rpx;
  72. background-color: #1e7dfb;
  73. }
  74. }
  75. }
  76. </style>