wui-components-v2 1.2.85 → 1.2.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -288,6 +288,15 @@ function downloadExportFile() {
288
288
 
289
289
  console.log(props.buttons, '33333')
290
290
 
291
+ // 顶部可见按钮数量:仅剩一个时按钮不拉伸占满整行(去掉 flex-1,按内容自适应宽度)
292
+ const visibleBtnCount = computed(() => {
293
+ let count = 0
294
+ if (props.buttons.includes('dtmplAdd')) count++
295
+ if (props.buttons.includes('exportLtmplExcel')) count++
296
+ if (props.batchOpsVisible !== false) count++
297
+ return count
298
+ })
299
+
291
300
  // 供父组件(如 wui-list 底部批量操作条)触发文件导出弹窗
292
301
  defineExpose({
293
302
  openExportPopup,
@@ -296,11 +305,17 @@ defineExpose({
296
305
 
297
306
  <template>
298
307
  <view v-if="showButtons" class="flex justify-end gap-1 py-2 px-2 bg-white dark:bg-[var(--wot-dark-background)]">
299
- <wd-button class="flex-1" v-if="buttons.includes('dtmplAdd')" type="primary" @click="gotoAddPage" icon="plus">
308
+ <wd-button
309
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
310
+ v-if="buttons.includes('dtmplAdd')"
311
+ type="primary"
312
+ @click="gotoAddPage"
313
+ icon="plus"
314
+ >
300
315
  {{ props.config?.editBtnTitle || '新增' }}
301
316
  </wd-button>
302
317
  <wd-button
303
- class="flex-1"
318
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
304
319
  v-if="buttons.includes('exportLtmplExcel')"
305
320
  type="primary"
306
321
  @click="openExportPopup()"
@@ -312,7 +327,7 @@ defineExpose({
312
327
  <slot />
313
328
  <wd-button
314
329
  v-if="props.batchOpsVisible !== false"
315
- class="flex-1"
330
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
316
331
  type="primary"
317
332
  @click="emit('batchEdit')"
318
333
  :icon="props.batchEditing ? 'close' : 'edit'"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.85",
3
+ "version": "1.2.86",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",