examPractice.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <top-return text="评测练习"></top-return>
  4. <view class="view-box">
  5. <view class="trade">
  6. <view class="texts" :class="curr==0?'active':''" data-index="0" @tap="setCurr">
  7. 第一个页面
  8. </view>
  9. <view class="texts" :class="curr==1?'active':''" data-index="1" @tap="setCurr">
  10. 第二个页面
  11. </view>
  12. <view class="texts" :class="curr==2?'active':''" data-index="2" @tap="setCurr">
  13. 第三个页面
  14. </view>
  15. </view>
  16. <swiper style="height: 80vh;" :current="curr" @change="setCurr">
  17. <swiper-item>
  18. <scroll-view>
  19. aaa
  20. </scroll-view>
  21. </swiper-item>
  22. <swiper-item>
  23. <scroll-view>
  24. bbb
  25. </scroll-view>
  26. </swiper-item>
  27. <swiper-item>
  28. <scroll-view>
  29. ccc
  30. </scroll-view>
  31. </swiper-item>
  32. </swiper>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapState
  39. } from 'vuex'
  40. export default {
  41. computed: {
  42. ...mapState('m_children', ['examPractice'])
  43. },
  44. data() {
  45. return {
  46. index: '',
  47. curr: 0
  48. }
  49. },
  50. onLoad(param) {
  51. this.index = param.index
  52. },
  53. methods: {
  54. setCurr(e) {
  55. let thisCurr = e.detail.current || e.currentTarget.dataset.index || 0;
  56. this.curr = thisCurr;
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. .view-box{
  63. margin-top: 10vh;
  64. .trade{
  65. width: 100%;
  66. color: $title;
  67. overflow: auto;
  68. height: 5vh;
  69. }
  70. .trade view{
  71. text-align: center;
  72. padding-left: 25upx;
  73. width: 30%;
  74. float: left;
  75. }
  76. .trade .texts.active{
  77. border-bottom: 8upx solid $color-blue;
  78. }
  79. }
  80. </style>