Skip to content

Commit ff8a8e7

Browse files
AK47-dadadagitee-org
authored andcommitted
update src/components/Pagination/index.vue.
解决了当全局size为small的时候分页组件样式太大的问题,当组件为small时,则会显示小的分页组件,具体请参照ep官网:https://element-plus.org/zh-CN/component/pagination.html#%E9%99%84%E5%8A%A0%E5%8A%9F%E8%83%BD Signed-off-by: AKING <[email protected]>
1 parent 65f9e3e commit ff8a8e7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/Pagination/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,27 @@
88
:page-sizes="[10, 20, 30, 50, 100]"
99
:pager-count="pagerCount"
1010
:total="total"
11+
:small="isSmall"
1112
class="float-right mt-15px mb-15px"
1213
layout="total, sizes, prev, pager, next, jumper"
1314
@size-change="handleSizeChange"
1415
@current-change="handleCurrentChange"
1516
/>
1617
</template>
1718
<script lang="ts" setup>
18-
import { computed } from 'vue'
19+
import { computed, watchEffect } from 'vue'
20+
import { useAppStore } from '@/store/modules/app'
1921
2022
defineOptions({ name: 'Pagination' })
2123
24+
// 此处解决了当全局size为small的时候分页组件样式太大的问题
25+
const appStore = useAppStore()
26+
const layoutCurrentSize = computed(() => appStore.currentSize)
27+
const isSmall = ref<boolean>(layoutCurrentSize.value === 'small')
28+
watchEffect(() => {
29+
isSmall.value = layoutCurrentSize.value === 'small'
30+
})
31+
2232
const props = defineProps({
2333
// 总条目数
2434
total: {

0 commit comments

Comments
 (0)