fix: 插槽重复问题;默认分页参数

This commit is contained in:
2023-08-14 18:55:55 +08:00
parent 28f73e68b3
commit fb4369711a
2 changed files with 7 additions and 16 deletions

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-08-14 11:07:15
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-08-14 17:26:33
* @LastEditTime: 2023-08-14 18:54:43
* @FilePath: \vue3\packages\select-transfer-modal\index.vue
* @Description:
*
@ -44,15 +44,8 @@
}" :data="data" :filter-method="filterMethod" :props="props"
>
<template #default="{ option }">
<slot :option="option">
<div flex h-100px>
<div grow>
{{ option.name }}
</div>
<div v-if="optionRight">
{{ option[optionRight] }}
</div>
</div>
<slot name="transfer" :option="option">
{{ option[props.label] }}
</slot>
</template>
<template #left-footer>
@ -90,7 +83,6 @@ const properties = withDefaults(
defaultParams?: Record<string, any>
formItems?: FormItem[]
request: (args: any) => Promise<Page>
layout?: string
optionRight?: string
pageSizes?: number[]
pagerCount?: number
@ -105,7 +97,7 @@ const properties = withDefaults(
props: () => ({ key: 'id', label: 'name', disabled: 'disabled' }),
show: false,
defaultParams: () => ({}),
pageSizes: () => [10, 20, 30, 50],
pageSizes: () => [20, 50, 100, 200],
pagerCount: document.body.clientWidth < 992 ? 5 : 7,
hidePagination: false,
title: '选择',
@ -133,7 +125,7 @@ function filterMethod(_query: string, item: TransferDataItem) {
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
pageSize: properties.pageSizes[0] || 10,
})
const data = computed(() => {

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-08-14 11:07:15
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-08-14 16:45:09
* @LastEditTime: 2023-08-14 18:52:56
* @FilePath: \vue3\stories\SelectTransferModal.stories.ts
* @Description:
*
@ -43,8 +43,7 @@ const meta = {
formItems: [{ label: 'label1', prop: 'prop1' }, { label: 'label2', prop: 'prop2', selectOptions: [{ label: '1', value: '1' }, { label: '2', value: '2' }] }],
request,
optionRight: 'value',
layout: 'total, sizes, prev, pager, next, jumper',
pageSizes: [10, 20, 30, 50],
pageSizes: [20, 50, 100, 200],
pagerCount: document.body.clientWidth < 992 ? 5 : 7,
props: { key: 'id', label: 'name', disabled: 'disabled' },
hidePagination: false,