y-action-sheet.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <u-popup ref="popup" :show="show" closeable type="bottom">
  3. <view class="content">
  4. <view v-if="data.title" class="cell bold center title">
  5. <text>{{ data.title }}</text>
  6. </view>
  7. <view class="cell list dfsb" @click="change(item, index)" v-for="(item, index) in data.list" :key="index">
  8. <text class="flex1">{{ item.text }}</text>
  9. <image v-if="sel != index" class="icon" src="/static/img/pro/wxz.png" mode=""></image>
  10. <image v-if="sel == index" class="icon" src="/static/img/pro/xuanzhong.png" mode=""></image>
  11. </view>
  12. <view class="cell center cancel-btn" @click="confirm"><text>确定</text></view>
  13. </view>
  14. </u-popup>
  15. </template>
  16. <script>
  17. /**
  18. * 底部选择菜单
  19. */
  20. export default {
  21. data() {
  22. return {
  23. show: false,
  24. sel: 0,
  25. selItem: 0,
  26. data: {}
  27. };
  28. },
  29. methods: {
  30. change(item, ind) {
  31. this.sel = ind;
  32. this.selItem = item;
  33. },
  34. //选择回调
  35. confirm() {
  36. this.$util.throttle(() => {
  37. this.$emit('onConfirm', this.selItem);
  38. });
  39. this.close();
  40. },
  41. open(data) {
  42. this.data = data;
  43. this.show = true;
  44. },
  45. close() {
  46. this.show = false;
  47. }
  48. }
  49. };
  50. </script>
  51. <style scoped lang="scss">
  52. .content {
  53. background-color: #fff;
  54. border-radius: 16rpx 16rpx 0 0;
  55. overflow: hidden;
  56. }
  57. .list {
  58. padding: 0 30rpx;
  59. }
  60. .cell {
  61. min-height: 88rpx;
  62. font-size: 32rpx;
  63. color: #333;
  64. position: relative;
  65. width: 100%;
  66. &:after {
  67. position: absolute;
  68. z-index: 3;
  69. left: 0;
  70. top: auto;
  71. bottom: 0;
  72. right: 0;
  73. height: 0;
  74. content: '';
  75. transform: scaleY(0.5);
  76. }
  77. &:last-child {
  78. color: #fff;
  79. width: 750rpx;
  80. height: 100rpx;
  81. background: linear-gradient(90deg, #ffac4c 0%, #ff8a00 100%);
  82. line-height: 100rpx;
  83. border-top: 12rpx solid #f7f7f7;
  84. }
  85. &.title {
  86. height: 100rpx;
  87. line-height: 100rpx;
  88. font-size: 36rpx;
  89. }
  90. .icon {
  91. width: 36rpx;
  92. height: 36rpx;
  93. }
  94. }
  95. </style>