DetailBody.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- 商品详情 -->
  2. <template>
  3. <view
  4. class="div ui-detail-swiper"
  5. v-bind:class="{
  6. 'has-goods-stock': isStock <= 0
  7. }"
  8. >
  9. <view :style="'height:'+navHeight+'px'"></view>
  10. <product-info v-if="index == 0"></product-info>
  11. <product-desc v-if="index == 1"></product-desc>
  12. <product-review v-if="index == 2"></product-review>
  13. </view>
  14. </template>
  15. <script>
  16. import ProductInfo from './child/ProductInfo'
  17. import ProductDesc from './child/ProductDesc'
  18. import ProductReview from './child/ProductReview'
  19. import { mapState, mapMutations } from 'vuex'
  20. export default {
  21. data() {
  22. return {
  23. navHeight:0
  24. }
  25. },
  26. props: ['isStock'],
  27. components: {
  28. ProductInfo,
  29. ProductDesc,
  30. ProductReview
  31. },
  32. computed: {
  33. ...mapState({
  34. index: state => state.pointsgoods.index,
  35. })
  36. },
  37. mounted: function() {
  38. // #ifdef MP-WEIXIN
  39. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  40. // #endif
  41. },
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .ui-detail-swiper {
  46. position: absolute;
  47. width: 100%;
  48. box-sizing: border-box;
  49. padding-top:$headerHeight;
  50. padding-bottom:$footerHeight;
  51. top: var(--status-bar-height);
  52. bottom: constant(safe-area-inset-bottom);/*兼容 IOS<11.2*/bottom: env(safe-area-inset-bottom);/*兼容 IOS>11.2*/
  53. left: 0;
  54. right: 0;
  55. overflow: auto;
  56. z-index: 0;
  57. /* border: 1px solid red; */
  58. background: rgba(240, 242, 245, 1);
  59. &.has-goods-stock {
  60. bottom: 4.1rem;
  61. }
  62. }
  63. </style>