index.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="position-analysis-page">
  3. <van-tabs
  4. :active="activeType"
  5. sticky
  6. animated
  7. swipeable
  8. color="#E3B377"
  9. id="tabs"
  10. >
  11. <van-tab
  12. :title="item.exchange"
  13. v-for="item in list"
  14. :key="item.exchange"
  15. :name="item.exchange"
  16. >
  17. <indexContent :list="item.items" :num="item.num" :time="item.data_time" :exchange="item.exchange"/>
  18. </van-tab>
  19. </van-tabs>
  20. </view>
  21. </template>
  22. <script>
  23. import {apiPositionAnalysisList} from '@/api/positionAnalysis.js'
  24. import indexContent from './components/indexContent.vue'
  25. export default {
  26. components:{indexContent},
  27. data() {
  28. return {
  29. list:[],
  30. activeType:''
  31. }
  32. },
  33. onLoad(){
  34. this.getList()
  35. },
  36. onPullDownRefresh() {
  37. this.getList()
  38. setTimeout(() => {
  39. uni.stopPullDownRefresh()
  40. }, 1500);
  41. },
  42. //转发分享
  43. onShareAppMessage(){
  44. return{
  45. title:'持仓分析',
  46. }
  47. },
  48. methods: {
  49. async getList(){
  50. const res=await apiPositionAnalysisList()
  51. if(res.code===200){
  52. this.list=res.data||[]
  53. this.activeType=res.data[0]&&res.data[0].exchange
  54. this.$nextTick(()=>{
  55. this.selectComponent('#tabs').resize();
  56. })
  57. }
  58. }
  59. },
  60. }
  61. </script>
  62. <style lang="scss">
  63. page{
  64. padding-bottom: constant(safe-area-inset-bottom);
  65. padding-bottom: env(safe-area-inset-bottom);
  66. }
  67. .van-sticky-wrap--fixed{
  68. box-shadow: 0px 4px 4px rgba(198, 198, 198, 0.25);
  69. }
  70. </style>