DetailBody.vue 1.8 KB

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