index.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { Cell, Sticky, Tab, Tabs } from 'vant'
  2. import { defineComponent } from 'vue'
  3. import styles from './index.module.less'
  4. import List from './list'
  5. import { useRect } from '@vant/use'
  6. import { useEventTracking } from '@/helpers/hooks'
  7. import ColHeader from '@/components/col-header'
  8. import TheSticky from '@/components/the-sticky'
  9. export default defineComponent({
  10. name: 'tradeRecord',
  11. data() {
  12. return {
  13. active: 'buy',
  14. height: 44
  15. }
  16. },
  17. mounted() {
  18. // this.$nextTick(() => {
  19. // const { height } = useRect((this as any).$refs.tabs)
  20. // this.height = height
  21. // })
  22. useEventTracking('交易记录')
  23. },
  24. render() {
  25. return (
  26. <div class={styles.tradeRecord}>
  27. <TheSticky
  28. position="top"
  29. onBarHeight={(height: any) => {
  30. this.height = height
  31. }}
  32. >
  33. <ColHeader isFixed={false} />
  34. <Tabs
  35. v-model:active={this.active}
  36. color="var(--van-primary)"
  37. sticky
  38. lineWidth={28}
  39. >
  40. <Tab name="buy" title="购买记录"></Tab>
  41. <Tab name="refund" title="退费记录"></Tab>
  42. </Tabs>
  43. </TheSticky>
  44. {this.active === 'buy' && <List height={this.height} />}
  45. {this.active === 'refund' && (
  46. <List height={this.height} type="refund" />
  47. )}
  48. </div>
  49. )
  50. }
  51. })