博主信息
博文 48
粉丝 3
评论 1
访问量 45904
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
uni-app之tab选项卡
吴长清
原创
2428人浏览过
  • 直接上代码
  1. <template>
  2. <orderNavbar></orderNavbar>
  3. <view class="content">
  4. <!-- <text>我的订单</text> -->
  5. <view>
  6. <view class="tabs">
  7. <view :class="['tabs-item',index==0?'tabs-item-tag':'']" @click="chooseTab(0)">全部</view>
  8. <view :class="['tabs-item',index==1?'tabs-item-tag':'']" @click="chooseTab(1)">待支付</view>
  9. <view :class="['tabs-item',index==2?'tabs-item-tag':'']" @click="chooseTab(2)">进行中</view>
  10. <view :class="['tabs-item',index==3?'tabs-item-tag':'']" @click="chooseTab(3)">已完成</view>
  11. <view :class="['tabs-item',index==4?'tabs-item-tag':'']" @click="chooseTab(4)">已取消</view>
  12. </view>
  13. <view :class="[index==0?'item':'']" v-show="index==0">
  14. <image src="/static/order/dingdan.png"></image>
  15. <text>全部订单</text>
  16. </view>
  17. <view :class="[index==1?'item':'']" v-show="index==1">
  18. <image src="/static/order/dingdan.png"></image>
  19. <text>待支付的订单</text>
  20. </view>
  21. <view :class="[index==2?'item':'']" v-show="index==2">
  22. <image src="/static/order/dingdan.png"></image>
  23. <text>进行中的订单</text>
  24. </view>
  25. <view :class="[index==3?'item':'']" v-show="index==3">
  26. <image src="/static/order/dingdan.png"></image>
  27. <text>已完成的订单</text>
  28. </view>
  29. <view :class="[index==4?'item':'']" v-show="index==4">
  30. <image src="/static/order/dingdan.png"></image>
  31. <text>已取消的订单</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. // 默认显示0
  41. index: 0,
  42. };
  43. },
  44. methods: {
  45. // 切换
  46. chooseTab(index) {
  47. this.index = index;
  48. }
  49. },
  50. }
  51. </script>
  52. <style lang="scss">
  53. .content {
  54. .tabs {
  55. height: 60rpx;
  56. display: flex;
  57. margin-top: 10rpx;
  58. .tabs-item {
  59. // 平均分布
  60. flex: 1;
  61. text-align: center;
  62. color: #111111;
  63. height: 60rpx;
  64. line-height: 60rpx;
  65. }
  66. .tabs-item-tag {
  67. color: #5BA7FF;
  68. border-bottom: 4rpx solid #5BA7FF;
  69. }
  70. }
  71. .item {
  72. padding: 10rpx;
  73. display: grid;
  74. image {
  75. width: 400rpx;
  76. margin: auto;
  77. margin-top: 100rpx;
  78. }
  79. text {
  80. text-align: center;
  81. }
  82. }
  83. }
  84. </style>
  • 效果预览

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学