You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.5 KiB

4 years ago
  1. <template>
  2. <uni-popup ref="popup" type="bottom">
  3. <view class="content">
  4. <view v-if="data.title" class="cell b-b center title">
  5. <text >{{ data.title }}</text>
  6. </view>
  7. <view class="cell b-b center" v-for="(item, index) in data.list" :key="index" @click="confirm(item)">
  8. <text>{{ item.text }}</text>
  9. </view>
  10. <view class="cell center cancel-btn" @click="close">
  11. <text>取消</text>
  12. </view>
  13. </view>
  14. </uni-popup>
  15. </template>
  16. <script>
  17. /**
  18. * 底部选择菜单
  19. */
  20. export default {
  21. data() {
  22. return {
  23. data: {}
  24. };
  25. },
  26. methods: {
  27. //选择回调
  28. confirm(item){
  29. this.$util.throttle(()=>{
  30. this.$emit('onConfirm', item)
  31. })
  32. this.close();
  33. },
  34. open(data){
  35. this.data = data;
  36. this.$refs.popup.open();
  37. },
  38. close(){
  39. this.$refs.popup.close();
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .content{
  46. background-color: #fff;
  47. border-radius: 16rpx 16rpx 0 0;
  48. overflow: hidden;
  49. }
  50. .cell{
  51. min-height: 88rpx;
  52. font-size: 32rpx;
  53. color: #333;
  54. position: relative;
  55. &:after{
  56. position: absolute;
  57. z-index: 3;
  58. left: 0;
  59. top: auto;
  60. bottom: 0;
  61. right: 0;
  62. height: 0;
  63. content: '';
  64. transform: scaleY(.5);
  65. border-bottom: 1px solid #f5f5f5;
  66. }
  67. &:last-child{
  68. height: 96rpx;
  69. border-top: 12rpx solid #f7f7f7;
  70. }
  71. &.title{
  72. height: 100rpx;
  73. font-size: 28rpx;
  74. color: #999;
  75. }
  76. }
  77. </style>