switch-tab.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="page-width">
  3. <form report-submit v-on:submit="getFormId">
  4. <view class="page-width switch-tab dir-left-nowrap">
  5. <button class="box-grow-1 item" v-on:click="setTab(0)" formType="submit">
  6. <text :class="[`${tab_status === 0 ? theme + '-border-bottom' : 'default'}`, `${tab_status === 0 ? theme + '-color' : 'default-color'}`, `text`]">我送出的</text>
  7. </button>
  8. <button class="box-grow-1 item" v-on:click="setTab(1)" formType="submit">
  9. <text :class="[`${tab_status === 1 ? theme + '-border-bottom' : 'default'}`, `${tab_status === 1 ? theme + '-color' : 'default-color'}`, `text`]">我收到的</text>
  10. </button>
  11. <button class="box-grow-1 item" v-on:click="setTab(2)" formType="submit">
  12. <text :class="[`${tab_status === 2 ? theme + '-border-bottom' : 'default'}`, `${tab_status === 2 ? theme + '-color' : 'default-color'}`, `text`]">我参与的</text>
  13. </button>
  14. </view>
  15. </form>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'switch-tab',
  21. props: {
  22. theme: String,
  23. },
  24. data() {
  25. return {
  26. tab_status: 0,
  27. }
  28. },
  29. methods: {
  30. getFormId() {},
  31. setTab(data) {
  32. this.$emit('setTab', data);
  33. this.tab_status = data;
  34. },
  35. },
  36. }
  37. </script>
  38. <style scoped lang="scss">
  39. @import "../../css/gift.scss";
  40. .switch-tab {
  41. .item {
  42. text-align: center;
  43. background-color: #f7f7f7;
  44. border: none;
  45. margin: 0;
  46. height: #{104upx};
  47. line-height: #{104upx};
  48. border-radius: 0;
  49. }
  50. }
  51. // 文字
  52. .text {
  53. display: inline-block;
  54. font-size: #{28upx};
  55. line-height: #{60upx};
  56. border-bottom-width: #{2upx};
  57. border-bottom-style: solid;
  58. }
  59. .default {
  60. border-bottom-color: transparent;
  61. }
  62. .default-color {
  63. color: #666666;
  64. }
  65. </style>