tab.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="listtopb flexc" >
  3. <block v-for="(ite,idx) in tablist" :key='idx'>
  4. <block v-if='ite.limt'>
  5. <view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" v-if="checkPermi([ite.limt])">
  6. <view class="f16 fw mb6 tits" >{{ite.tit}}</view>
  7. <view class="f500 f14 txt" v-if="ite.txt||ite.txt==0">{{ite.txt}}</view>
  8. </view>
  9. </block>
  10. <block v-else>
  11. <view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" >
  12. <view class="f16 fw mb6 tits" >{{ite.tit}}</view>
  13. <view class="f500 f14 txt" v-if="ite.txt||ite.txt==0">{{ite.txt}}</view>
  14. </view>
  15. </block>
  16. </block>
  17. </view>
  18. </template>
  19. <script>
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. export default{
  22. props:{
  23. tablist:{
  24. type: Array,
  25. default () {
  26. return []
  27. }
  28. },
  29. height:{
  30. type: Number,
  31. default () {
  32. return 90
  33. }
  34. },
  35. tabidx:{
  36. type: Number,
  37. default () {
  38. return 0
  39. }
  40. }
  41. },
  42. data(){
  43. return{
  44. // tabidxs:0,
  45. }
  46. },
  47. mounted() {
  48. // this.tabidxs=this.tabidx
  49. },
  50. methods:{
  51. checkPermi, checkRole,
  52. getTab(idx){
  53. // this.tabidxs=idx;
  54. this.$emit('getCheck',idx)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .listtopb{
  61. .tit{flex: 1;display: flex;flex-direction: column;justify-content: center;position: relative;
  62. view{text-align: center;}
  63. .tits{color: #666666;}
  64. .txt{color: #aaaaaa;}
  65. &.act{
  66. &::after{content: '';width: 100rpx;height: 6rpx;background:#FE5706 ;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
  67. .tits{color: #343434;}
  68. .txt{color: #FE5706;}
  69. }
  70. }
  71. }
  72. </style>