fix:searching with replaceFields fix #548,#557 (#569)

* fix: update selected before row-click event(#548)

* fix(tree): searching with replaceFields(#557)
This commit is contained in:
Netfan 2021-05-06 21:10:29 +08:00 committed by GitHub
parent 5724bc5b3b
commit 1ff13bf459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 28 deletions

View File

@ -36,8 +36,8 @@ export function useCustomRow(
const customRow = (record: Recordable, index: number) => {
return {
onClick: (e: Event) => {
emit('row-click', record, index, e);
e?.stopPropagation();
function handleClick() {
const { rowSelection, rowKey, clickToRowSelect } = unref(propsRef);
if (!rowSelection || !clickToRowSelect) return;
const keys = getSelectRowKeys();
@ -67,6 +67,9 @@ export function useCustomRow(
}
clearSelectedRowKeys();
}
}
handleClick();
emit('row-click', record, index, e);
},
onDblclick: (event: Event) => {
emit('row-dbClick', record, index, event);

View File

@ -185,9 +185,13 @@
searchState.startSearch = true;
const { title: titleField } = unref(getReplaceFields);
searchState.searchData = filter(unref(treeDataRef), (node) => {
searchState.searchData = filter(
unref(treeDataRef),
(node) => {
return node[titleField]?.includes(searchValue) ?? false;
});
},
unref(getReplaceFields)
);
}
function handleClickNode(key: string, children: TreeItem[]) {