Unverified 提交 1ff13bf4 作者: Netfan 提交者: GitHub

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

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

* fix(tree): searching with replaceFields(#557)
上级 5724bc5b
...@@ -36,8 +36,8 @@ export function useCustomRow( ...@@ -36,8 +36,8 @@ export function useCustomRow(
const customRow = (record: Recordable, index: number) => { const customRow = (record: Recordable, index: number) => {
return { return {
onClick: (e: Event) => { onClick: (e: Event) => {
emit('row-click', record, index, e);
e?.stopPropagation(); e?.stopPropagation();
function handleClick() {
const { rowSelection, rowKey, clickToRowSelect } = unref(propsRef); const { rowSelection, rowKey, clickToRowSelect } = unref(propsRef);
if (!rowSelection || !clickToRowSelect) return; if (!rowSelection || !clickToRowSelect) return;
const keys = getSelectRowKeys(); const keys = getSelectRowKeys();
...@@ -67,6 +67,9 @@ export function useCustomRow( ...@@ -67,6 +67,9 @@ export function useCustomRow(
} }
clearSelectedRowKeys(); clearSelectedRowKeys();
} }
}
handleClick();
emit('row-click', record, index, e);
}, },
onDblclick: (event: Event) => { onDblclick: (event: Event) => {
emit('row-dbClick', record, index, event); emit('row-dbClick', record, index, event);
......
...@@ -185,9 +185,13 @@ ...@@ -185,9 +185,13 @@
searchState.startSearch = true; searchState.startSearch = true;
const { title: titleField } = unref(getReplaceFields); const { title: titleField } = unref(getReplaceFields);
searchState.searchData = filter(unref(treeDataRef), (node) => { searchState.searchData = filter(
unref(treeDataRef),
(node) => {
return node[titleField]?.includes(searchValue) ?? false; return node[titleField]?.includes(searchValue) ?? false;
}); },
unref(getReplaceFields)
);
} }
function handleClickNode(key: string, children: TreeItem[]) { function handleClickNode(key: string, children: TreeItem[]) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论