Favorite.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="我的收藏" class="common-header" left-icon="back" @clickLeft="goBack">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="tab-wrapper">
  13. <view class="tab-item" @click="onClickItem(0)" v-bind:class="{'active':selected == 0}">收藏店铺<text class="icon"></text></view>
  14. <view class="tab-item" @click="onClickItem(1)" v-bind:class="{'active':selected == 1}">收藏商品<text class="icon"></text></view>
  15. </view>
  16. <favorite-store v-if="selected==0"></favorite-store>
  17. <favorite-goods v-if="selected==1"></favorite-goods>
  18. </view></member-base>
  19. </template>
  20. <script>
  21. import {getFontSize} from '@/util/common'
  22. import TitleHeader from '../../TitleHeader'
  23. import MemberBase from '../MemberBase'
  24. import FavoriteGoods from './FavoriteGoods'
  25. import FavoriteStore from './FavoriteStore'
  26. export default {
  27. components:{
  28. TitleHeader,
  29. MemberBase,
  30. FavoriteGoods,
  31. FavoriteStore
  32. },
  33. name:'MemberFavorite',
  34. mounted(){
  35. // #ifdef MP-WEIXIN
  36. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  37. // #endif
  38. },
  39. computed:{
  40. fontSize(){
  41. return getFontSize()
  42. },
  43. },
  44. data(){
  45. return {
  46. navHeight: 0,
  47. selected: 0
  48. }
  49. },
  50. methods: {
  51. onClickItem(e) {
  52. if (this.selected !== e.currentIndex) {
  53. this.selected = e
  54. }
  55. },
  56. goBack () {
  57. uni.navigateBack({delta:1})
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .container .tab-wrapper{margin-bottom:.5rem;height: 3rem;background: #fff;margin-top: .3rem;display: flex;align-items: center;}
  64. .container .tab-wrapper .tab-item{width: 50%;display: flex;justify-content: center;font-size: .8rem;position: relative;}
  65. .container .tab-wrapper .tab-item.active{color: $primaryColor;}
  66. .container .tab-wrapper .tab-item.active .icon{position: absolute;width: 1rem;height: .2rem;background: $primaryColor;border-radius: 0.5rem;bottom: -.3rem;}
  67. </style>