Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能完善]搜索框组件下拉框不会自动隐藏 #11

Closed
anyshift opened this issue Apr 21, 2023 · 1 comment
Closed

[功能完善]搜索框组件下拉框不会自动隐藏 #11

anyshift opened this issue Apr 21, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@anyshift
Copy link

目前还没有看到有相关方法暴露出用于手动关闭下拉框:

pic

@readpage readpage added the enhancement New feature or request label Apr 21, 2023
@readpage readpage self-assigned this May 5, 2023
@readpage
Copy link
Owner

readpage commented May 11, 2023

<template>
  <u-search :config="config" style="margin-left: 20px" @submit="submit" ref="searchRef"></u-search>
  <div>abdds</div>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { SearchConfig, SearchInstance } from 'undraw-ui'

defineOptions({
  name: 'search'
})

const searchRef = ref<SearchInstance>()

const config = reactive<SearchConfig>({
  keywords: [],
  hotSearchList: []
})

onMounted(() => {
  setTimeout(() => {
    config.keywords = ['斗罗大陆', '斗破苍穹', '吞噬星空', '凡人修仙传', '一念永恒'] // 搜索框关键字滚动
    config.hotSearchList = [
      '斗罗大陆',
      '斗破苍穹',
      '吞噬星空',
      '凡人修仙传',
      '一念永恒',
      '完美世界',
      '鬼灭之刃',
      '间谍过家家',
      '武动乾坤',
      '神印王座'
    ] // top10 热门搜索 最多显示10条数据
  }, 200)
})
const submit = (val: string) => {
  console.log(val)
  searchRef.value?.close()
  // window.open('/all?keyword=' + val)
}
</script>

<style lang="scss" scoped></style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants