index.vue 889 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <view class="index_container">
  3. <view class="segmented_control_container">
  4. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
  5. activeColor="#409eff"></uni-segmented-control>
  6. </view>
  7. <view class="content">
  8. <view id="all" v-show="current === 0">待办</view>
  9. <view id="readed" v-show="current === 1">在办</view>
  10. <view id="unread" v-show="current === 2">办结</view>
  11. <view id="unread" v-show="current === 3">我的</view>
  12. </view>
  13. </view>
  14. </template>
  15. <script setup lang="ts">
  16. import { reactive, ref } from 'vue';
  17. const items = reactive(['待办', '在办', '办结', '我的'])
  18. const current = ref(0)
  19. function onClickItem(e) {
  20. if (current != e.currentIndex) {
  21. current.value = e.currentIndex;
  22. }
  23. }
  24. </script>
  25. <style lang="scss">
  26. .segmented_control_container {
  27. margin-top: 10px;
  28. }
  29. </style>