lijingjia 3 weeks ago
parent 57396bc432
commit 9371dd450d

@ -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,

@ -23,7 +23,6 @@ export function useTable(tableProps?: Props): [
const tableRef = ref<Nullable<TableActionType>>(null)
const loadedRef = ref<Nullable<boolean>>(false)
const formRef = ref<Nullable<UseTableMethod>>(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()
},

@ -86,6 +86,7 @@ export interface TableActionType {
reload: (opt?: FetchParams) => Promise<void>
setSelectedRows: (rows: Recordable[]) => void
getSelectRows: <T = Recordable>() => T[]
getVxeSelectRows: () => []
clearSelectedRowKeys: () => void
expandAll: () => void
expandRows: (keys: string[] | number[]) => void

Loading…
Cancel
Save