mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
perf: XTable hooks
This commit is contained in:
parent
df8a0768ea
commit
f2d2dc4d9e
@ -8,14 +8,14 @@ export interface tableMethod {
|
|||||||
exportList: (fileName?: string) => void
|
exportList: (fileName?: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useXTable(props: XTableProps): [Function, tableMethod] {
|
export const useXTable = (props: XTableProps): [Function, tableMethod] => {
|
||||||
const tableRef = ref<Nullable<tableMethod>>(null)
|
const tableRef = ref<Nullable<tableMethod>>(null)
|
||||||
|
|
||||||
function register(instance) {
|
const register = (instance) => {
|
||||||
tableRef.value = instance
|
tableRef.value = instance
|
||||||
props && instance.setProps(props)
|
props && instance.setProps(props)
|
||||||
}
|
}
|
||||||
function getInstance(): tableMethod {
|
const getInstance = (): tableMethod => {
|
||||||
const table = unref(tableRef)
|
const table = unref(tableRef)
|
||||||
if (!table) {
|
if (!table) {
|
||||||
console.error('表格实例不存在')
|
console.error('表格实例不存在')
|
||||||
|
Loading…
Reference in New Issue
Block a user