contract-set.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <uni-popup ref="popupRef" type="top">
  3. <view class="set-box" :style="{'top':contractTop + 'px'}">
  4. <view class="set-foot"></view>
  5. <view class="set-item" @click.stop="setInfo(1)">
  6. <text class="set-item-icon iconfont">&#xe629;</text>
  7. <text class="">偏好设置</text>
  8. </view>
  9. <view class="set-item" @click.stop="setInfo(2)">
  10. <text class="set-item-icon iconfont">&#xe6c1;</text>
  11. <text class="">合约计算器</text>
  12. </view>
  13. </view>
  14. </uni-popup>
  15. </template>
  16. <script>
  17. import {
  18. mapGetters
  19. } from 'vuex'
  20. export default {
  21. name: "contract-set",
  22. data() {
  23. return {
  24. contractTop: 0
  25. };
  26. },
  27. computed: {
  28. ...mapGetters([
  29. "navBarHeight"
  30. ])
  31. },
  32. watch: {
  33. navBarHeight: {
  34. handler(newH) {
  35. this.contractTop = newH + uni.upx2px(78)
  36. },
  37. immediate: true
  38. }
  39. },
  40. mounted() {
  41. // this.$refs.popupRef.open()
  42. // this.open()
  43. },
  44. methods: {
  45. open(val) {
  46. this.$nextTick(() => {
  47. this.$refs.popupRef.open();
  48. })
  49. },
  50. close() {
  51. this.$refs.popupRef.close()
  52. },
  53. setInfo(type) {
  54. this.close();
  55. this.$emit('confirm', type)
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .set-box {
  62. min-width: 200rpx;
  63. background-color: #fff;
  64. position: absolute;
  65. right: 0;
  66. border-radius: 10rpx;
  67. padding-top: 20rpx;
  68. .set-foot {
  69. width: 0px;
  70. height: 0px;
  71. border: 12rpx solid transparent;
  72. border-top-color: #fff;
  73. transform: rotate(180deg);
  74. position: absolute;
  75. right: 20rpx;
  76. top: -20rpx;
  77. }
  78. // <view class="set-item">
  79. // <text class="set-item-icon iconfont">&#xe629;</text>
  80. // <text class="iconfont">偏好设置</text>
  81. // </view>
  82. .set-item {
  83. display: flex;
  84. padding: 20rpx;
  85. display: flex;
  86. align-items: center;
  87. font-size: 26rpx;
  88. &:nth-child(n - 1){
  89. border-bottom: 1rpx solid $border-color2;
  90. }
  91. .set-item-icon {
  92. font-size: 30rpx;
  93. margin-right: 16rpx;
  94. }
  95. }
  96. }
  97. </style>