select.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <ul class="selectcon">
  3. <li :class="{ active: active==2 }" @click="active=2,$emit('select',2)">
  4. <span class="txt">L2</span>
  5. <span class="line"></span>
  6. <span class="round"></span>
  7. </li>
  8. <span class="v-line" :style="{top:active==1?'30px': (active==2?'36px':'32px')}"></span>
  9. <li :class="{ active: active==1 }" @click="active=1,$emit('select',1)">
  10. <span class="txt">L1</span>
  11. <span class="line"></span>
  12. <span class="round"></span>
  13. </li>
  14. <span class="v-line" :style="{top:active=='b1'?'118px':'126px'}"></span>
  15. <li :class="{ active: active=='b1' }" @click="active='b1',$emit('select','b1')">
  16. <span class="txt">B1</span>
  17. <span class="line"></span>
  18. <span class="round"></span>
  19. </li>
  20. </ul>
  21. </template>
  22. <script>
  23. export default {
  24. props:['select'],
  25. data(){
  26. return {
  27. active:this.select
  28. }
  29. },
  30. watch:{
  31. '$route':{
  32. deep:true,
  33. handler:function (newVal) {
  34. console.log(newVal);
  35. if (newVal != 'Home') {
  36. this.showselect = true
  37. }
  38. }
  39. }
  40. }
  41. };
  42. </script>
  43. <style lang="less" scoped>
  44. .selectcon {
  45. position: fixed;
  46. top: 40px;
  47. right: 10px;
  48. color: #fff;
  49. > li {
  50. display: flex;
  51. align-items: center;
  52. justify-content: flex-end;
  53. cursor: pointer;
  54. margin-right: 5px;
  55. margin-top: 52px;
  56. &:first-of-type{
  57. margin-top: 0;
  58. }
  59. .txt {
  60. width: 80px;
  61. display: inline-block;
  62. height: 34px;
  63. line-height: 34px;
  64. text-align: right;
  65. }
  66. .line {
  67. display: inline-block;
  68. background: #fff;
  69. width: 24px;
  70. height: 1px;
  71. }
  72. .round {
  73. width: 32px;
  74. height: 32px;
  75. background: #fff;
  76. border-radius: 50%;
  77. }
  78. }
  79. .v-line{
  80. height: 60px;
  81. top: 36px;
  82. display: inline-block;
  83. background: #fff;
  84. width: 2px;
  85. position: absolute;
  86. right: 20px;
  87. }
  88. .active {
  89. margin-right: 0;
  90. .txt {
  91. width: 80px;
  92. display: inline-block;
  93. height: 34px;
  94. line-height: 34px;
  95. border-radius: 60px;
  96. background: linear-gradient(270deg, #00cfff 0%, #00aaff 100%);
  97. border: 4px solid #fff;
  98. box-sizing: content-box;
  99. text-align: center;
  100. }
  101. .line {
  102. display: inline-block;
  103. background: #fff;
  104. width: 24px;
  105. height: 2px;
  106. }
  107. .round {
  108. width: 42px;
  109. height: 42px;
  110. background: linear-gradient(270deg, #00cfff 0%, #00aaff 100%);
  111. border-radius: 50%;
  112. border: 8px solid #fff;
  113. }
  114. }
  115. }
  116. </style>