hookehuyr

style(PaginationField): 重构分页组件布局使用网格系统

将actions容器从flex布局改为grid布局,实现左中右三列对齐
左列(上一页)靠左,中列(提交)居中,右列(下一页)靠右
1 <!-- 1 <!--
2 * @Date: 2025-11-18 16:17:40 2 * @Date: 2025-11-18 16:17:40
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-11-20 17:56:14 4 + * @LastEditTime: 2025-11-25 14:48:19
5 * @FilePath: /data-table/src/components/PaginationField/index.vue 5 * @FilePath: /data-table/src/components/PaginationField/index.vue
6 * @Description: 分页组件 6 * @Description: 分页组件
7 --> 7 -->
...@@ -9,16 +9,22 @@ ...@@ -9,16 +9,22 @@
9 <div class="pagination-field"> 9 <div class="pagination-field">
10 <div class="indicator">第{{ current + 1 }}页 / 共{{ total }}页</div> 10 <div class="indicator">第{{ current + 1 }}页 / 共{{ total }}页</div>
11 <div class="actions"> 11 <div class="actions">
12 - <van-button 12 + <div class="actionsLeft">
13 - v-if="showPrev" 13 + <van-button
14 - :disabled="prev_disabled_effective || current === 0" 14 + v-if="showPrev"
15 - round 15 + :disabled="prev_disabled_effective || current === 0"
16 - type="primary" 16 + round
17 - class="btn" 17 + type="primary"
18 - @click="onPrev" 18 + class="btn"
19 - >{{ prev_label_effective }}</van-button> 19 + @click="onPrev"
20 - <van-button v-if="showNext" round type="primary" class="btn" @click="onNext">{{ nextLabel }}</van-button> 20 + >{{ prev_label_effective }}</van-button>
21 - <van-button v-if="showSubmit" round type="primary" class="btn" @click="onSubmit">{{ submitButton.text }}</van-button> 21 + </div>
22 + <div class="actionsCenter">
23 + <van-button v-if="showSubmit" round type="primary" class="btn" @click="onSubmit">{{ submitButton.text }}</van-button>
24 + </div>
25 + <div class="actionsRight">
26 + <van-button v-if="showNext" round type="primary" class="btn" @click="onNext">{{ nextLabel }}</van-button>
27 + </div>
22 </div> 28 </div>
23 </div> 29 </div>
24 </template> 30 </template>
...@@ -93,13 +99,29 @@ const onSubmit = () => emit('submit') ...@@ -93,13 +99,29 @@ const onSubmit = () => emit('submit')
93 margin-bottom: 0.5rem; 99 margin-bottom: 0.5rem;
94 } 100 }
95 101
96 - .actions { 102 + .actions {
97 - display: flex; 103 + // 三列栅格:左列起始(上一页),中列居中(提交),右列末尾(下一页)
98 - gap: 0.75rem; 104 + display: grid;
105 + width: 100%;
106 + grid-template-columns: 1fr auto 1fr;
107 + align-items: start; // 垂直方向顶对齐
108 + min-height: 44px; // 保障容器高度,按钮靠顶部
99 109
100 - .btn { 110 + .actionsLeft {
101 - min-width: 6rem; 111 + justify-self: start; // 左对齐到边
112 + }
113 +
114 + .actionsCenter {
115 + justify-self: center; // 中间居中
116 + }
117 +
118 + .actionsRight {
119 + justify-self: end; // 右对齐到边
120 + }
121 +
122 + .btn {
123 + min-width: 6rem;
124 + }
102 } 125 }
103 - }
104 } 126 }
105 </style> 127 </style>
......