fix: BOM搜索子件名称+自动搜索防抖
This commit is contained in:
@ -240,7 +240,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed, nextTick } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, nextTick, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox, FormInstance, FormRules } from 'element-plus'
|
||||
import { Plus, Search, EditPen } from '@element-plus/icons-vue'
|
||||
@ -289,6 +289,15 @@ const activeCategories = ref([]) // 默认全部展开
|
||||
const searchKeyword = ref('')
|
||||
const childSearchKeyword = ref('')
|
||||
|
||||
// ★ 自动搜索:输入后 500ms 防抖触发搜索(无需回车)
|
||||
watch(searchKeyword, (val) => {
|
||||
// 防抖:延迟 500ms 执行,避免频繁请求
|
||||
clearTimeout((window as any)._bomSearchTimer)
|
||||
;(window as any)._bomSearchTimer = setTimeout(() => {
|
||||
fetchBomList()
|
||||
}, 500)
|
||||
})
|
||||
|
||||
// ============================================================
|
||||
// 【改造】分页 + 远程搜索相关状态
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user