多端小程序通用 radio-group

水深无声 2021-09-30 15:20 465阅读 0赞

前言:

1.除了支付宝外的小程序 radio都可以重复点击,确认取消

2.之前多选按钮是自己的手撸控件,为了还原设计效果

3.微信端label需要设置 block属性

  1. <template>
  2. <view class="page">
  3. <view class="container" v-if="isok">
  4. <view class="content">
  5. <text class="t1">订单已取消</text>
  6. <view class="t2" @click="reOrder">重新预约</view>
  7. <view class="resonBox">
  8. <text class="r1">请告诉我们原因</text>
  9. <radio-group @change="radioChange" class="radioGroup">
  10. <label v-for="(item, index) in items" :key="index">
  11. <radio :checked="item.checked" :value="item.name" @click=""></radio>
  12. <text >{
  13. { item.value }}</text>
  14. </label>
  15. </radio-group>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. let _self;
  23. export default {
  24. data() {
  25. return {
  26. isok: true,
  27. items: [
  28. { name: '1', value: '计划有变,暂时不需要服务了' },
  29. { name: '2', value: '赶时间,更改为其他服务方式'},
  30. { name: '3', value: '预约信息有误' },
  31. { name: '4', value: '误发预约' },
  32. { name: '5', value: '其他' }
  33. ]
  34. };
  35. },
  36. onLoad() {
  37. _self = this;
  38. },
  39. methods: {
  40. reOrder() {},
  41. plan() {
  42. _self.isPlan = !_self.isPlan;
  43. },
  44. radioChange(e){
  45. console.log(e.detail.value);
  46. }
  47. }
  48. };
  49. </script>
  50. <style lang="less">
  51. .content {
  52. padding: 50upx 60upx;
  53. text-align: left;
  54. font-family: PingFangSC-regular;
  55. .t1 {
  56. color: rgba(16, 16, 16, 1);
  57. font-size: 56upx;
  58. }
  59. .t2 {
  60. margin-left: 145upx;
  61. background-color: rgba(255, 255, 255, 1);
  62. color: rgba(153, 153, 153, 1);
  63. font-size: 28upx;
  64. text-align: center;
  65. font-family: Arial;
  66. border: 2upx solid rgba(255, 255, 255, 0);
  67. display: inline-block;
  68. vertical-align: middle;
  69. position: relative;
  70. top: -15upx;
  71. }
  72. .radioGroup {
  73. height: 430upx;
  74. }
  75. .radioGroup > label {
  76. margin-top: 25upx;
  77. width: 100%;
  78. height: 45upx;
  79. display: block;
  80. }
  81. .radioGroup > label > text {
  82. margin-left: 15upx;
  83. vertical-align: middle;
  84. }
  85. .resonBox {
  86. margin-top: 80upx;
  87. .r1 {
  88. color: rgba(16, 16, 16, 1);
  89. font-size: 28upx;
  90. }
  91. radio {
  92. vertical-align: middle;
  93. }
  94. }
  95. }
  96. </style>

发表评论

表情:
评论列表 (有 0 条评论,465人围观)

还没有评论,来说两句吧...

相关阅读

    相关 程序通用搜索组件

    效果图 ![2.gif][] 场景 一个应用经常少不了搜索功能,为此在这里简单封装一个搜索组件,可以为后续开发省下一些时间; 编写一个common-searc