feat: 🎸 Table组件重构完成并给出相应示例
This commit is contained in:
@@ -1,6 +1,40 @@
|
||||
// 常用的增删改查 hook
|
||||
import { reactive } from 'vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
export function() {
|
||||
|
||||
interface DefalutParams {
|
||||
pageIndex: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
export function useExample() {
|
||||
const defalutParams = reactive<DefalutParams>({
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
const tableData = ref<any[]>([])
|
||||
|
||||
const loading = ref<boolean>(true)
|
||||
|
||||
const total = ref<number>(0)
|
||||
|
||||
function sizeChange(val: number) {
|
||||
loading.value = true
|
||||
defalutParams.pageIndex = 1
|
||||
defalutParams.pageSize = val
|
||||
}
|
||||
|
||||
function currentChange(val: number) {
|
||||
loading.value = true
|
||||
defalutParams.pageIndex = val
|
||||
}
|
||||
|
||||
return {
|
||||
defalutParams,
|
||||
tableData,
|
||||
loading,
|
||||
total,
|
||||
sizeChange,
|
||||
currentChange
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user