index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="vsearch" v-clickoutside="handleOutside">
  3. <div class="vinput" @click.stop @keydown.stop @touchstart.stop>
  4. <input @click="isShow=true" @focus="isShow=true" type="text" placeholder="请输入关键字…" v-model="key">
  5. <img :src="require(`@/assets/images/project/icon/search.png`)" alt="">
  6. </div>
  7. <div class="cpylist" :class="{listactive:isShow}">
  8. <p class="btmdashline">参展项目及企业</p>
  9. <ul v-if="region.length>0">
  10. <li class="textActive" v-for="(item,i) in region" :key="i">
  11. <p @click.stop="handleItem(item)">{{item.name}}</p>
  12. </li>
  13. </ul>
  14. <ul v-else>
  15. <li>未搜索到该项目</li>
  16. </ul>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import {Booth} from '@/data/raw'
  22. let fixBooth = Booth.filter(item=>(item.mapId.indexOf('xt')<=-1))
  23. let arr = []
  24. export default {
  25. props:['currentPanoid'],
  26. data(){
  27. this.u_extend(arr,fixBooth)
  28. return {
  29. key:'',
  30. region:arr,
  31. isShow: false
  32. }
  33. },
  34. watch:{
  35. currentPanoid(){
  36. this.isShow=false
  37. },
  38. key(newVal){
  39. let tmpregion = []
  40. this.u_extend(tmpregion,fixBooth)
  41. if (!newVal) {
  42. this.region = tmpregion
  43. }
  44. else{
  45. this.region = tmpregion.filter(item=>{
  46. if (item.name.indexOf(newVal)>-1) {
  47. return item
  48. }
  49. })
  50. }
  51. }
  52. },
  53. methods:{
  54. handleOutside(){
  55. this.isShow = false
  56. },
  57. handleItem(item){
  58. this.$bus.$emit('ifrMessage',{
  59. events:'flyToPano',
  60. data:item
  61. })
  62. this.handleOutside()
  63. }
  64. },
  65. mounted(){
  66. }
  67. }
  68. </script>
  69. <style lang="less" scoped>
  70. ::-webkit-scrollbar {
  71. width: 2px;
  72. height: 2px;
  73. }
  74. ::-webkit-scrollbar-thumb {
  75. height: 2px;
  76. background-color: rgba(255, 255, 255, 0.4);
  77. outline: 2px solid rgba(255, 255, 255, 0.4);
  78. }
  79. ::-webkit-scrollbar-thumb:hover {
  80. height: 2px;
  81. background-color: rgba(255, 255, 255, 0.4);
  82. }
  83. .vsearch{
  84. width: 300px;
  85. color: #fff;
  86. .vinput{
  87. display: flex;
  88. justify-content: space-between;
  89. align-items: center;
  90. background: rgba(0, 0, 0, 0.5);
  91. border-radius: 20px;
  92. padding: 0 20px;
  93. width: 100%;
  94. >input{
  95. line-height: 35px;
  96. height: 35;
  97. color: #fff;
  98. width: 80%;
  99. }
  100. >img{
  101. width: 20px;
  102. cursor: pointer;
  103. }
  104. }
  105. .cpylist{
  106. margin-top: 8px;
  107. background: rgba(0, 0, 0, 0.5);
  108. border-radius: 20px;
  109. padding: 0;
  110. max-height: 0;
  111. overflow: hidden;
  112. transition: all ease .3s;
  113. >p{
  114. font-size: 18px;
  115. font-weight: bold;
  116. padding: 0 10px 18px;
  117. }
  118. >ul{
  119. max-height: calc(100vh - 160px);
  120. overflow-y: auto;
  121. padding:0 15px 0;
  122. >li{
  123. margin: 18px 0;
  124. &:last-of-type{
  125. margin-bottom: 0;
  126. }
  127. >ul{
  128. // margin-left: 20px;
  129. >li{
  130. margin: 18px 0;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. .listactive{
  137. padding: 25px 18px 18px;
  138. max-height: 100vh;
  139. }
  140. }
  141. </style>