动态table高度
This commit is contained in:
@@ -2,7 +2,7 @@ import { reactive } from 'vue'
|
||||
import createAxios from '@/utils/request'
|
||||
import { requestPayload } from '@/utils/request'
|
||||
import { Method } from 'axios'
|
||||
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
interface TableStoreParams {
|
||||
url: string
|
||||
pk?: string
|
||||
@@ -10,6 +10,8 @@ interface TableStoreParams {
|
||||
params?: anyObj
|
||||
method?: Method
|
||||
isWebPaging?: boolean // 是否前端分页
|
||||
showPage?: boolean
|
||||
publicHeight?: number
|
||||
resetCallback?: () => void
|
||||
loadCallback?: () => void
|
||||
}
|
||||
@@ -20,6 +22,7 @@ export default class TableStore {
|
||||
public method: Method
|
||||
public initData: any = null
|
||||
public isWebPaging = false
|
||||
public showPage = true
|
||||
public table: CnTable = reactive({
|
||||
ref: null,
|
||||
selection: [],
|
||||
@@ -33,7 +36,9 @@ export default class TableStore {
|
||||
loading: true,
|
||||
column: [],
|
||||
loadCallback: null,
|
||||
resetCallback: null
|
||||
resetCallback: null,
|
||||
height: mainHeight(20 + (this.showPage ? 58 : 0)).height as string,
|
||||
publicHeight: 0
|
||||
})
|
||||
|
||||
constructor(public options: TableStoreParams) {
|
||||
@@ -42,6 +47,8 @@ export default class TableStore {
|
||||
this.isWebPaging = options.isWebPaging || false
|
||||
this.method = options.method || 'GET'
|
||||
this.table.column = options.column
|
||||
this.showPage = options.showPage || true
|
||||
this.table.publicHeight = options.publicHeight || 0
|
||||
this.table.resetCallback = options.resetCallback || null
|
||||
this.table.loadCallback = options.loadCallback || null
|
||||
Object.assign(this.table.params, options.params)
|
||||
|
||||
Reference in New Issue
Block a user