| | |
| | | v-model="show"
|
| | | width="600"
|
| | | @close="close"
|
| | | :show-close="false"
|
| | | :show-close="true" |
| | | append-to-body
|
| | | >
|
| | | <el-input
|
| | |
| | | import { isHttp } from '@/utils/validate'
|
| | | import usePermissionStore from '@/store/modules/permission'
|
| | |
|
| | | const props = defineProps({ |
| | | keyword: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }) |
| | | |
| | | const search = ref('')
|
| | | const options = ref([])
|
| | | const searchPool = ref([])
|
| | |
| | | function click() {
|
| | | show.value = !show.value
|
| | | if (show.value) {
|
| | | syncSearchFromKeyword() |
| | | nextTick(() => { |
| | | headerSearchSelectRef.value && headerSearchSelectRef.value.focus()
|
| | | options.value = searchPool.value
|
| | | }) |
| | | }
|
| | | } |
| | | |
| | | function syncSearchFromKeyword() { |
| | | search.value = props.keyword?.trim?.() ?? '' |
| | | querySearch(search.value) |
| | | } |
| | | |
| | | function open(keyword = props.keyword) { |
| | | show.value = true |
| | | search.value = keyword?.trim?.() ?? '' |
| | | querySearch(search.value) |
| | | nextTick(() => { |
| | | headerSearchSelectRef.value && headerSearchSelectRef.value.focus() |
| | | }) |
| | | }
|
| | |
|
| | | function close() {
|
| | |
| | | watch(searchPool, (list) => {
|
| | | initFuse(list)
|
| | | })
|
| | | |
| | | defineExpose({ |
| | | open |
| | | }) |
| | | </script>
|
| | |
|
| | | <style lang='scss' scoped>
|