// @ts-nocheck
|
import { defineComponent, useAttrs, ref, SetupContext, PropType } from 'vue'
|
import BaseTable from './index.vue'
|
import type { TablePropsItemType } from './index.d'
|
// 注释时间2024-10-09
|
// 该表格是从多个小项目迁移改造而来,经历过多重改造,代码比较乱,如果需要重构,请基于components/BaseTable/BaseTable.tsx继续重构。
|
// 另外本地vxe-table和线上vxe-table版本不一致,有可能有差异性,比如watch数据不执行等。注意避坑。
|
export default defineComponent<TablePropsItemType>({
|
props: BaseTable.props,
|
// emits: BaseTable.emits,
|
setup(props, ctx: SetupContext) {
|
// const emits: any = BaseTable.emits
|
// const eventMap: Record<string, any> = {}
|
const tableRef = ref()
|
|
// emits.forEach((eventName: string) => {
|
// const onEventName = `on${eventName
|
// .slice(0, 1)
|
// .toUpperCase()}${eventName.slice(1)}`
|
// eventMap[onEventName] = (...args: any) => ctx.emit(eventName, ...args)
|
// })
|
|
/**
|
* 暴露方法
|
* @param exposeMap
|
*/
|
const onUpdatedExpose = (exposeMap: Record<string, () => void>) => {
|
ctx.expose(exposeMap)
|
}
|
|
return () => {
|
return (
|
<BaseTable
|
ref={tableRef}
|
{...props}
|
{...ctx.attrs}
|
// {...eventMap}
|
v-slots={{ ...ctx.slots }}
|
onUpdate={onUpdatedExpose}
|
/>
|
)
|
}
|
},
|
})
|