CartHeader.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. components:{
  30. TitleHeader
  31. },
  32. props: {
  33. issShowTabbar: {
  34. type: Number,
  35. default: 0
  36. },
  37. isEmpty: {
  38. type: Boolean,
  39. default: false
  40. }
  41. },
  42. computed: {
  43. },
  44. methods: {
  45. /*
  46. * goBack: 返回上一页
  47. */
  48. goBack () {
  49. uni.navigateBack({delta:1})
  50. },
  51. /*
  52. * changeFinishStatus: 点击编辑和完成向父组件发送事件, 编辑状态, 列表默认全选, 完成状态默认全部不选中, 并改变是否是完成的状态
  53. */
  54. changeFinishStatus () {
  55. this.isFinish = !this.isFinish
  56. let data = { isFinish: this.isFinish }
  57. uni.$emit('change-list-selected', data)
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .cart-header-wrapper {
  64. position: fixed;
  65. width: -webkit-fill-available;
  66. .span {
  67. position: absolute;
  68. font-size:$h3;
  69. color: rgba(78, 84, 93, 1);
  70. display: inline-block;
  71. height: 2.2rem;
  72. line-height: 2.2rem;
  73. top: 0;
  74. right: 0.75rem;
  75. }
  76. }
  77. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  78. </style>