tab.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. {{ite.tit}}
  7. </view>
  8. </block>
  9. <block v-else>
  10. <view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" >
  11. {{ite.tit}}
  12. </view>
  13. </block>
  14. </block>
  15. <!-- 切换按钮 -->
  16. <!-- <view :style="'height:'+height+'rpx'" class="chebox" @click="getroleFn" v-if="checkPermi(['register:teacher:list'])&&tabbtn">
  17. <image :src="micone"></image>
  18. </view> -->
  19. </view>
  20. </template>
  21. <script>
  22. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  23. export default{
  24. props:{
  25. tablist:{
  26. type: Array,
  27. default () {
  28. return []
  29. }
  30. },
  31. height:{
  32. type: Number,
  33. default () {
  34. return 100
  35. }
  36. },
  37. tabbtn:{
  38. type:Boolean,
  39. default () {
  40. return false
  41. }
  42. },
  43. tabidx:{
  44. type: [String,Number],
  45. default () {
  46. return ''
  47. }
  48. }
  49. },
  50. data(){
  51. return{
  52. // :0,
  53. }
  54. },
  55. mounted() {
  56. // this.tabidxs=this.tabidx
  57. },
  58. methods:{
  59. checkPermi, checkRole,
  60. getTab(idx){
  61. // this.tabidxs=idx;
  62. this.$emit('getCheck',idx)
  63. },
  64. getroleFn(){
  65. this.$emit('getroleFn')
  66. },
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .listtopb{
  72. background-color:#00A9F0;
  73. .tit{flex: 1;display: flex;justify-content: center;position: relative;font-weight: 500;align-items: center;
  74. font-size: 26rpx;
  75. color: #FFFFFF;
  76. &.act{font-weight: bold;font-size: 30rpx;
  77. &::after{content: '';width: 30rpx;height: 10rpx;background:#FFFFFF;position: absolute;left: 50%;margin-left: -10rpx;bottom: 16rpx;border-radius: 4rpx;}
  78. }
  79. }
  80. }
  81. </style>