This commit is contained in:
ChenQiuYu 2025-05-07 15:34:46 +08:00
parent a6c6f3fb64
commit 9b60a81802
1 changed files with 23 additions and 26 deletions

View File

@ -1,23 +1,23 @@
<template> <template>
<el-input
ref="inputRef"
style="width: 100%;height: 100%"
v-model="keyword"
:prefix-icon="Plus"
:placeholder="props.placeholder"
clearable
@input="changeInput"
class="no-border-input"
:disabled="disabled"
@focus="focus"
@click="changeInput"
>
<el-popover placement="bottom-start" :visible="isVisible" :width="props.width" ref="popoverRef" >
</el-input>
<el-popover placement="bottom-start" trigger="click" :width="props.width" ref="popoverRef" :virtual-ref="inputRef"
:trigger-keys="[]"> :trigger-keys="[]">
<template #reference>
<el-input
ref="inputRef"
v-model="keyword"
:prefix-icon="Plus"
:placeholder="props.placeholder"
:style="{ width: props.width + 'px' }"
clearable
@input="changeInput"
class="no-border-input"
:disabled="disabled"
@focus="focus"
@blur="handlerBlur"
@click="changeInput"
/>
</template>
<div class="container"> <div class="container">
<el-table <el-table
:data="searchList" style="width: 100%" :data="searchList" style="width: 100%"
@ -34,18 +34,16 @@
</el-table> </el-table>
</div> </div>
</el-popover> </el-popover>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">import {ref, unref} from "vue";
import {ref, unref} from "vue";
import {post} from "@/utils/request.ts"; import {post} from "@/utils/request.ts";
import {Plus} from "@element-plus/icons-vue"; import {Plus} from "@element-plus/icons-vue";
const keyword = ref(""); const keyword = ref("");
const popoverRef = ref(); const popoverRef = ref();
const inputRef = ref(); const inputRef = ref();
const isVisible = ref(false);
interface showConfig { interface showConfig {
prop: string; prop: string;
label: string; label: string;
@ -56,6 +54,10 @@ const props = defineProps({
type: String, type: String,
default: "" default: ""
}, },
width: {
type: Number,
default: 1000
},
showConfig: { showConfig: {
type: Array as () => showConfig[], type: Array as () => showConfig[],
default: () => [] default: () => []
@ -102,13 +104,8 @@ const beforeShow = () => {
}; };
const focus=()=>{ const focus=()=>{
isVisible.value=true
console.log( "focus输入框")
emit('focus',true) emit('focus',true)
} }
const handlerBlur = () => {
isVisible.value = false
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">