p-i-s-tabbar.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="content">
  3. <view class="tabbar">
  4. <view class="list_item">
  5. <view class="item" :class="active === 1 ? 'active':''" @click="click_item(1)">
  6. <view class="item_icon icon_one"></view>
  7. <view class="item_name">
  8. 模拟量
  9. </view>
  10. </view>
  11. <view class="item" :class="active === 2 ? 'active':''" @click="click_item(2)">
  12. <view class="item_icon icon_two"></view>
  13. <view class="item_name">
  14. 开关量
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. active:1,
  26. };
  27. },
  28. methods:{
  29. click_item(item){
  30. this.active = item
  31. this.$emit("tab","item")
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="scss">
  37. .content{
  38. position: fixed;
  39. bottom: 0;
  40. }
  41. .tabbar{
  42. width: 750rpx;
  43. .list_item{
  44. width: 100%;
  45. border-top: 2rpx solid #f3f3f3;
  46. box-sizing: border-box;
  47. padding: 12rpx 0;
  48. .item{
  49. float: left;
  50. width: 50%;
  51. .item_icon{
  52. margin: 0 auto;
  53. width: 45rpx;
  54. height: 45rpx;
  55. background-size: cover;
  56. background-repeat: no-repeat;
  57. }
  58. .icon_one{
  59. background-image: url(icon/ss1.png);
  60. }
  61. .icon_two{
  62. background-image: url(icon/work.png);
  63. }
  64. .item_name{
  65. text-align: center;
  66. font-size: 25rpx;
  67. font-family: PingFangSC-Regular, PingFang SC;
  68. font-weight: 400;
  69. color: #929292;
  70. line-height: 40rpx;
  71. }
  72. }
  73. .active{
  74. .icon_one{
  75. background-image: url(icon/ss2.png);
  76. }
  77. .icon_two{
  78. background-image: url(icon/work_active.png);
  79. }
  80. .item_name{
  81. color: #3498DB;
  82. }
  83. }
  84. }
  85. }
  86. </style>