diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index b3e122da..591df114 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -204,7 +204,12 @@ export default defineComponent({ }, emit, ) - + // 获取vxe选中状态的数据 + function getVxeSelectRows () { + console.log(tableElRef.value) + // console.log(tableElRef.value.getCheckboxRecords()) + // return tableElRef.value.getCheckboxRecords() + } function handleTableChange(...args) { onTableChange.call(undefined, ...args) emit('change', ...args) @@ -291,7 +296,6 @@ export default defineComponent({ // } propsData = omit(propsData, ['class', 'onChange']) - console.log(propsData) return propsData }) @@ -328,6 +332,7 @@ export default defineComponent({ const tableAction: TableActionType = { reload, getSelectRows, + getVxeSelectRows, setSelectedRows, clearSelectedRowKeys, getSelectRowKeys, @@ -363,7 +368,7 @@ export default defineComponent({ }, } createTableContext({ ...tableAction, wrapRef, getBindValues }) - + console.log(tableAction) expose(tableAction) emit('register', tableAction, formActions) @@ -376,8 +381,6 @@ export default defineComponent({ // props.rowDbClick(row) } const vxeCheckBoxChange = (v) => { - setSelectedRows(v.row) - console.log(getSelectRows()) } return { formRef, diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index 91f47613..61aa0814 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -23,7 +23,6 @@ export function useTable(tableProps?: Props): [ const tableRef = ref>(null) const loadedRef = ref>(false) const formRef = ref>(null) - let stopWatch: WatchStopHandle function register(instance: TableActionType, formInstance: UseTableMethod) { @@ -32,7 +31,6 @@ export function useTable(tableProps?: Props): [ tableRef.value = null loadedRef.value = null }) - if (unref(loadedRef) && isProdMode() && instance === unref(tableRef)) return tableRef.value = instance @@ -110,6 +108,9 @@ export function useTable(tableProps?: Props): [ getSelectRows: () => { return toRaw(getTableInstance().getSelectRows()) }, + getVxeSelectRows: () => { + return getTableInstance().getVxeSelectRows() + }, clearSelectedRowKeys: () => { getTableInstance().clearSelectedRowKeys() }, diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index d7cf9372..09be5649 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -86,6 +86,7 @@ export interface TableActionType { reload: (opt?: FetchParams) => Promise setSelectedRows: (rows: Recordable[]) => void getSelectRows: () => T[] + getVxeSelectRows: () => [] clearSelectedRowKeys: () => void expandAll: () => void expandRows: (keys: string[] | number[]) => void