addHouse.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <view class="u-tabs-box">
  5. <u-tabs-swiper ref="tabs" :current="current" :is-scroll="false" :list="tabList" bar-width="120"
  6. swiperWidth="750" @change="change"></u-tabs-swiper>
  7. </view>
  8. <swiper :current="swiperCurrent" class="swiper-box" @animationfinish="animationfinish" @transition="transition">
  9. <swiper-item class="swiper-item">
  10. <add-all-house :model="model"></add-all-house>
  11. </swiper-item>
  12. <swiper-item class="swiper-item">
  13. <add-sub-house :model="model"></add-sub-house>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import addAllHouse from '@/components/zy/addAllHouse.vue'
  21. import addSubHouse from '@/components/zy/addSubHouse.vue'
  22. export default {
  23. components: {
  24. addAllHouse, addSubHouse
  25. },
  26. data() {
  27. return {
  28. tabList: [{name: '整租'}, {name: '合租'}],
  29. current: 0,
  30. swiperCurrent: 0,
  31. tabsHeight: 0,
  32. // 房源对象
  33. model: null,
  34. };
  35. },
  36. onLoad: function (option) {
  37. this.model = JSON.parse(option.room)
  38. },
  39. methods: {
  40. // tab栏切换
  41. change(index) {
  42. this.swiperCurrent = index;
  43. },
  44. transition({detail: {dx}}) {
  45. this.$refs.tabs.setDx(dx);
  46. },
  47. animationfinish({detail: {current}}) {
  48. this.$refs.tabs.setFinishCurrent(current);
  49. this.swiperCurrent = current;
  50. this.current = current;
  51. this.model.type = current;
  52. }
  53. }
  54. };
  55. </script>
  56. <style>
  57. page {
  58. background-color: #FFFFFF;
  59. }
  60. </style>
  61. <style lang="scss" scoped>
  62. .tabSwiper {
  63. width: 710 rpx;
  64. background-color: #ffffff;
  65. margin: 20 rpx auto;
  66. border-radius: 20 rpx;
  67. box-sizing: border-box;
  68. padding: 20 rpx;
  69. font-size: 28 rpx;
  70. .top {
  71. display: flex;
  72. justify-content: space-between;
  73. .left {
  74. display: flex;
  75. align-items: center;
  76. .title {
  77. margin: 0 10 rpx;
  78. font-size: 32 rpx;
  79. font-weight: bold;
  80. }
  81. }
  82. .right {
  83. color: $u-tips-color;
  84. }
  85. }
  86. .item {
  87. display: flex;
  88. margin: 20 rpx 0 0;
  89. .left {
  90. margin-right: 20 rpx;
  91. image {
  92. width: 200 rpx;
  93. height: 200 rpx;
  94. border-radius: 10 rpx;
  95. }
  96. }
  97. .content {
  98. .title {
  99. font-size: 28 rpx;
  100. line-height: 50 rpx;
  101. }
  102. }
  103. .right {
  104. margin-left: 10 rpx;
  105. padding-top: 20 rpx;
  106. text-align: right;
  107. }
  108. }
  109. }
  110. .wrap {
  111. display: flex;
  112. flex-direction: column;
  113. height: calc(100vh - var(--window-top));
  114. width: 100%;
  115. }
  116. .swiper-box {
  117. flex: 1;
  118. }
  119. .swiper-item {
  120. height: 100%;
  121. }
  122. </style>