picker.vue 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view>
  3. <view class="topbtns mr12" @click="getShowFn">
  4. <block v-if="pickval==0">
  5. <image :src="online" class="limg"></image>上线中
  6. </block>
  7. <block v-if="pickval==1">
  8. <image :src="noline" v-if="pickval==1" class="limg"></image>离线中
  9. </block>
  10. <image :src="upimg" class="upimg"></image>
  11. <view class="pickbg" v-if="pickflag" @click.stop="getHideFn"></view>
  12. <view class="absbox" v-if="pickflag">
  13. <view class="uni-popper__arrow"></view>
  14. <view class="lists">
  15. <view class="list" v-for="(ite,idx) in list" :key="idx" @click.stop="getTabFn(ite.val)">{{ite.tit}}</view>
  16. <!-- <view class="list">离线</view> -->
  17. </view>
  18. </view>
  19. </view>
  20. <loading></loading>
  21. </view>
  22. </template>
  23. <script>
  24. import config from '@/config'
  25. const baseUrl = config.baseUrl
  26. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  27. export default {
  28. components: {},
  29. props:{
  30. localdata:{
  31. type: Array,
  32. default () {
  33. return []
  34. }
  35. },
  36. // value: {
  37. // type: [String, Number],
  38. // default: ''
  39. // },
  40. },
  41. data() {
  42. return {
  43. noline: require("@/static/images/home/noline.png"),
  44. online: require("@/static/images/home/online.png"),
  45. upimg: require("@/static/images/home/up.png"),
  46. pickflag: false,
  47. pickval:0,
  48. list:[{tit:"在线",val:0},{tit:"离线",val:1}]
  49. }
  50. },
  51. onLoad: function() {
  52. },
  53. methods: {
  54. getTabFn(val){
  55. this.pickval=val;
  56. this.pickflag=false;
  57. this.$emit("getChange",val)
  58. },
  59. getHideFn(){
  60. this.pickflag=false;
  61. },
  62. getShowFn(){
  63. this.pickflag=true;
  64. }
  65. }
  66. }
  67. </script>
  68. <style>
  69. page {
  70. background: #F3F3F0;
  71. }
  72. </style>
  73. <style lang="scss" scoped>
  74. .pickbg{position: fixed;left: 0;right: 0;top: 0;bottom: 0;z-index: 2;}
  75. .topbtns{font-weight: bold;background: rgba(93, 147, 255, 0.5);font-size: 24rpx;min-width: 174rpx;height: 52rpx;display: flex;align-items: center;padding: 0 20rpx;border-radius: 26rpx;color: #FFFFFF;box-sizing: border-box;position: relative;
  76. .upimg{width: 12rpx;height: 6rpx;flex: 0 0 auto;margin-left: 16rpx;}
  77. .limg{width: 24rpx;height: 24rpx;margin-right: 16rpx;flex: 0 0 auto;}
  78. }
  79. // 自定义选择框
  80. .absbox{position: absolute;box-sizing: border-box;position: absolute;top: calc(100% + 24rpx);left: 0;width: 100%;background-color: #FFFFFF;border: 2rpx solid #EBEEF5;border-radius:12rpx;box-shadow: 0 4rpx 24rpx 0 rgba(0, 0, 0, 0.1);z-index: 3;padding: 8rpx 0;
  81. .uni-popper__arrow{position: absolute;display: block;width: 0;height: 0;border-color: transparent;border-style: solid;border-width: 12rpx;filter: drop-shadow(0 4rpx 24rpx rgba(0, 0, 0, 0.03));top: -12rpx;left: 10%;margin-right: 6rpx;border-top-width: 0;border-bottom-color: #EBEEF5;
  82. &:after{position: absolute;display: block;width: 0;height: 0;border-color: transparent;border-style: solid;border-width: 12rpx;content: " ";top: 2rpx;margin-left: -12rpx;border-top-width: 0;border-bottom-color: #fff;}
  83. }
  84. .lists{width: 100%;height: 100%;overflow: auto;}
  85. .list{line-height: 70rpx;font-size: 28rpx;color: #272727;padding: 0 10rpx;
  86. &:hover {
  87. background-color: #f9f9f9;
  88. }
  89. }
  90. }
  91. </style>