tab.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. <image :src="tapline" class="line"></image>
  9. </view>
  10. </block>
  11. <block v-else>
  12. <view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" >
  13. <view class="f16 fw mb6 tits" >{{ite.tit}}</view>
  14. <view class="f500 f14 txt" v-if="ite.txt||ite.txt==0">{{ite.txt}}</view>
  15. <image :src="tapline" class="line"></image>
  16. </view>
  17. </block>
  18. </block>
  19. <!-- 切换按钮 -->
  20. <view :style="'height:'+height+'rpx'" class="chebox" @click="getroleFn" v-if="checkPermi(['register:teacher:list'])&&tabbtn">
  21. <image :src="micone"></image>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  27. export default{
  28. props:{
  29. tablist:{
  30. type: Array,
  31. default () {
  32. return []
  33. }
  34. },
  35. height:{
  36. type: Number,
  37. default () {
  38. return 100
  39. }
  40. },
  41. tabbtn:{
  42. type:Boolean,
  43. default () {
  44. return false
  45. }
  46. },
  47. tabidx:{
  48. type: Number,
  49. default () {
  50. return 0
  51. }
  52. }
  53. },
  54. data(){
  55. return{
  56. // :0,
  57. tapline:require("@/static/images/hline.png"),
  58. micone:require("@/static/images/micone.png"),
  59. }
  60. },
  61. mounted() {
  62. // this.tabidxs=this.tabidx
  63. },
  64. methods:{
  65. checkPermi, checkRole,
  66. getTab(idx){
  67. // this.tabidxs=idx;
  68. this.$emit('getCheck',idx)
  69. },
  70. getroleFn(){
  71. this.$emit('getroleFn')
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .listtopb{
  78. background-color: #ffffff;
  79. .tit{flex: 1;display: flex;flex-direction: column;justify-content: center;position: relative;
  80. view{text-align: center;}
  81. .tits{color: #AAAAAA ;}
  82. .txt{color: #aaaaaa;}
  83. .line{width: 40rpx;height: 12rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: 6rpx;display: none;}
  84. &.act{
  85. // &::after{content: '';width: 100rpx;height: 6rpx;background:#FE5706 ;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
  86. .tits{color: #161616;}
  87. .txt{color: #FE5706;}
  88. .line{display: block;}
  89. }
  90. }
  91. .chebox{width: 96rpx;background: #FFFFFF;
  92. box-shadow: -10rpx 0rpx 10rpx 0rpx rgba(196,191,191,0.22);display: flex;align-items: center;justify-content: center;
  93. image{width: 30rpx;height: 26rpx;}
  94. }
  95. }
  96. </style>