loulijun2021
2023-03-24 b08411e811e003ae2711e7ba8d92deaec9239de3
src/components/HeaderSearch/index.vue
@@ -13,7 +13,13 @@
      @change="change"
    >
      <el-option v-for="item in options" :key="item.path" :value="item" :label="item.item.title.join('>')" />
      <el-option
        v-for="item in options"
        v-show="item.item.title.length>1"
        :key="item.path"
        :value="item"
        :label="item.item.title.join('>')"
      />
    </el-select>
  </div>
</template>
@@ -57,8 +63,6 @@
  },
  mounted() {
    this.searchPool = this.generateRoutes(this.routes)
    console.log(this.searchPool)
  },
  methods: {
    click() {
@@ -73,7 +77,6 @@
      this.show = false
    },
    change(val) {
      console.log(val, 1)
      this.$router.push(val.item.path)
      this.search = ''
      this.options = []
@@ -101,12 +104,13 @@
    // Filter out the routes that can be displayed in the sidebar
    // And generate the internationalized title
    generateRoutes(routes, basePath = '/', prefixTitle = []) {
      // console.log(routes, 1)
      let res = []
      for (const router of routes) {
        // skip hidden router
        if (router.hidden) { continue }
        if (router.hidden) {
          continue
        }
        const data = {
          path: path.resolve(basePath, router.path),
@@ -131,7 +135,6 @@
          }
        }
      }
      // console.log(res, 2)
      return res
    },
    querySearch(query) {
@@ -155,8 +158,9 @@
    vertical-align: middle;
  }
  .svg-icon:hover{
    color: #42b983 !important;
  .svg-icon:hover {
    //color: #42b983 !important;
    color: rgb(170, 170, 170) !important;
  }
  .header-search-select {