menu_filter.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="menu-card" v-if="fls" @touchmove.stop.prevent @click="fls=false">
  3. <view class="filter" @touchmove.stop.prevent>
  4. <scroll-view scroll-y="true" style="height: 30vh;background: #1D1F1E;width: 686rpx;margin: auto;border-radius: 24rpx;">
  5. <view class="a">
  6. <view class="" v-for="item,i in list" :key="i" @click="click(item)">
  7. <image v-if="item.id==index" src="/static/market/3.png" mode="" style="width: 24rpx;height: 24rpx;"></image>
  8. <view :class="item.id==index?'b':''" class="item" >{{item.name}}</view>
  9. </view>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. arr: {
  19. type: Array,
  20. default: []
  21. },
  22. },
  23. data() {
  24. return {
  25. list: [],
  26. fls: false,
  27. index:''
  28. }
  29. },
  30. watch: {
  31. arr: {
  32. handler(newValue, oldValue) {
  33. if (newValue.length == 0) return
  34. this.list = newValue;
  35. },
  36. deep: true
  37. },
  38. },
  39. methods: {
  40. open() {
  41. this.fls = true;
  42. },
  43. close() {
  44. this.fls = false;
  45. },
  46. click(item) {
  47. // console.log(item.id)
  48. this.index =item.id
  49. this.$emit("click", item)
  50. this.fls = false;
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="less" scoped>
  56. .menu-card {
  57. background-color: rgba(0, 0, 0, 0.5);
  58. position: fixed;
  59. top: 300rpx;
  60. height: calc(100vh - 100rpx) !important;
  61. left: 0rpx;
  62. z-index: 666;
  63. width: 100%;
  64. padding: 0 !important;
  65. }
  66. .filter {
  67. background-color: #171918;
  68. // display: flex;
  69. align-items: center;
  70. // flex-wrap: wrap;
  71. padding: 20rpx 0;
  72. width: 100%;
  73. overflow: scroll;
  74. .a {
  75. // display: flex;
  76. flex-wrap: wrap;
  77. .item {
  78. // width: 320rpx;
  79. margin: 15rpx 20rpx;
  80. padding: 10rpx 0;
  81. font-size: 28rpx;
  82. text-align: center;
  83. }
  84. >view {
  85. display: flex;
  86. align-items: center;
  87. padding-left: 32rpx;
  88. }
  89. }
  90. .b {
  91. font-size: 22rpx;
  92. font-family: Tahoma-Bold, Tahoma;
  93. font-weight: bold;
  94. background: linear-gradient(180deg, #69FF60 0%, #0C9D5B 100%);
  95. -webkit-background-clip: text;
  96. -webkit-text-fill-color: transparent;
  97. }
  98. }
  99. </style>