CartHeader.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="div common-header-wrap">
  3. <view :style="'height:'+navHeight+'px'"></view>
  4. <view class="common-header-holder"></view>
  5. <view class="common-header-fixed">
  6. <title-header />
  7. <uni-nav-bar title="购物车" class="common-header" left-icon="back" @clickLeft="goBack()">
  8. <view class="div common-btn btn" slot="right" @click="changeFinishStatus()" v-if="!isFinish && !isEmpty">编辑</view>
  9. <view class="div common-btn btn" slot="right" @click="changeFinishStatus()" v-if="isFinish">完成</view>
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import TitleHeader from '../../../TitleHeader'
  16. import { mapState, mapMutations } from 'vuex'
  17. export default {
  18. mounted(){
  19. // #ifdef MP-WEIXIN
  20. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  21. // #endif
  22. },
  23. data(){
  24. return {
  25. navHeight: 0,
  26. isFinish: false // 是否是完成状态 编辑-完成false : 完成 - 编辑 true s - true - false
  27. }
  28. },
  29. props: {
  30. issShowTabbar: {
  31. type: Number,
  32. default: 0
  33. },
  34. isEmpty: {
  35. type: Boolean,
  36. default: false
  37. }
  38. },
  39. computed: {},
  40. methods: {
  41. /*
  42. * goBack: 返回上一页
  43. */
  44. goBack () {
  45. uni.navigateBack({delta:1})
  46. },
  47. /*
  48. * changeFinishStatus: 点击编辑和完成向父组件发送事件, 编辑状态, 列表默认全选, 完成状态默认全部不选中, 并改变是否是完成的状态
  49. */
  50. changeFinishStatus () {
  51. this.isFinish = !this.isFinish
  52. let data = { isFinish: this.isFinish }
  53. uni.$emit('change-list-selected', data)
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .cart-header-wrapper {
  60. position: fixed;
  61. width: -webkit-fill-available;
  62. .span {
  63. position: absolute;
  64. font-size:$h3;
  65. color: rgba(78, 84, 93, 1);
  66. display: inline-block;
  67. height:2.2rem;
  68. line-height:2.2rem;
  69. top: 0;
  70. right:0.75rem;
  71. }
  72. }
  73. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  74. </style>