u
This commit is contained in:
1 parent
a4e59dd5d1
commit
c7240ea7c9
16 files changed
+598
-476
No files matched your search
@@ -17,6 +17,10 @@ const props = defineProps({
|
||||
searchColumns: { type: Array, default: () => [] },
|
||||
orderField: { type: String, default: "" },
|
||||
sql: { type: String, default: "" },
|
||||
keepInput: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
// ===============================
|
||||
@@ -42,12 +46,9 @@ const inputChange = ref(false); // 输入变化标记
|
||||
const pagination = reactive({ page: 1, size: 10, total: 0 }); // 分页
|
||||
|
||||
const popperPaneRef = computed(() => popoverRef.value?.popperRef?.contentRef); // Popover 内容 DOM
|
||||
const searchColumns = computed(() => [
|
||||
props.labelKey,
|
||||
props.valueKey,
|
||||
...props.searchColumns,
|
||||
]); // 搜索列
|
||||
|
||||
const searchColumns = computed(() => {
|
||||
return [...new Set([props.labelKey, props.valueKey, ...props.searchColumns])];
|
||||
});
|
||||
// ===============================
|
||||
// Watchers
|
||||
// ===============================
|
||||
@@ -76,14 +77,19 @@ function onPopoverAfterLeave() {
|
||||
|
||||
function onPopoverBeforeLeave() {
|
||||
// 弹窗关闭前恢复或清空状态
|
||||
if (props.label) {
|
||||
if (innerInput.value === "") {
|
||||
emits("update:label", "");
|
||||
emits("update:modelValue", "");
|
||||
emits("change", null);
|
||||
} else {
|
||||
innerInput.value = props.label;
|
||||
if (!props.keepInput) {
|
||||
if (props.label) {
|
||||
if (innerInput.value === "") {
|
||||
emits("update:label", "");
|
||||
emits("update:modelValue", "");
|
||||
emits("change", null);
|
||||
} else {
|
||||
innerInput.value = props.label;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emits("update:label", innerInput.value);
|
||||
emits("update:modelValue", innerInput.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +205,7 @@ function _fetchOptions(searchTitle) {
|
||||
: [...options.value, ...res.data.rows];
|
||||
pagination.total = res.data.total;
|
||||
|
||||
popoverVisible.value = true
|
||||
popoverVisible.value = true;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in new issue
Block a user