智慧园区前端大屏
linwe
2024-11-07 a3eb3f7fd0889c3eed7ea5f5c812246779efa53c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-10-26 16:09:35
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-10-28 11:04:58
 * @FilePath: \bigScreen\src\views\layout\components\mainSearch.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by shuishen, All Rights Reserved. 
-->
<template>
  <div class="page-search">
    <el-input size="medium" placeholder="请输入内容" :suffix-icon="Search" @input="onSearch()" v-model="searchVal"
      @focus="onFocus"></el-input>
    <div class="page-search-value-box" v-show="isShowSearchSKValBox">
      <ul>
        <li v-for="(item, index) in searchSKValList" :key="index" @click="sKValItemClick(item)">{{ item.name }}
        </li>
      </ul>
    </div>
  </div>
</template>
 
<script setup>
// 搜索栏相关
let isShowSearchSKValBox = false
let searchVal = ''
let searchSKValList = []
 
const onSearch = () => {
  if (searchVal == '') {
    isShowSearchSKValBox = false
  } else {
    isShowSearchSKValBox = true
  }
}
 
const onFocus = () => {
  onSearch()
}
 
const sKValItemClick = (item) => {
  isShowSearchSKValBox = false
}
</script>
 
<style lang="scss" scoped>
.page-search {
  position: absolute;
  left: 488px;
  z-index: 99;
  top: 110px;
  pointer-events: auto;
 
  ::v-deep(.el-input) {
    height: 38px;
    width: 280px;
 
    .el-input__wrapper {
      font-size: 16px;
      font-weight: 400;
      border: 1px solid #4081CB;
      border-radius: 4px;
      background: rgba(135, 158, 199, 0.3);
      box-shadow: inset 0px 3px 7px 0px rgba(42, 138, 236, 0.95);
 
      .el-input__inner {
        color: #BFD3E5;
      }
    }
  }
 
  .page-search-value-box {
    position: absolute;
    width: 100%;
    height: 200px;
    left: 0;
    top: 40px;
    background: rgba(135, 158, 199, 0.3);
    border-radius: 2px;
    overflow-y: scroll;
 
    ul>li {
      color: #ffffff;
      cursor: pointer;
      height: 20px;
      line-height: 20px;
      padding-left: 10px;
    }
 
    ul>li:hover {
      background-color: #0e1a35;
    }
  }
 
  .page-search-value-box::-webkit-scrollbar {
    display: none
  }
}
</style>