查看: 37|回复: 0

vxe-table如何自定义拖拽列宽最小列宽限制,在不改变列min-width的情况下自定义最小列宽的限制

[复制链接]

4

主题

0

回帖

0

积分

热心网友

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2010-9-17
发表于 2025-6-13 16:26:00 | 显示全部楼层 |阅读模式

vxe-table如何自定义拖拽列宽最小列宽限制,在不改变列min-width的情况下,
例如需要自定义最小列宽的限制,默认是继承 column.min-width 限制,当需要脱离列限制时就有用了

查看官网:https://vxetable.cn
gitbub:https://github.com/x-extends/vxe-table
gitee:https://gitee.com/x-extends/vxe-table

效果

比如 name 这一列设置 min-width=200px,依然可以拖拽成最小列宽,由 resizable-config.minWidth 自定义

<template>
  <div>
    <vxe-grid v-bind="gridOptions"></vxe-grid>
  </div>
</template>

<script setup>
import { reactive } from 'vue'

const gridOptions = reactive({
  border: true,
  showOverflow: true,
  columnConfig: {
    resizable: true
  },
  resizableConfig: {
    minWidth: 60
  },
  columns: [
    { type: 'seq', width: 70 },
    { field: 'name', title: 'Name', minWidth: 200 },
    { field: 'sex', title: 'Sex', minWidth: 120 },
    { field: 'age', title: 'Age', width: 120 },
    { field: 'time', title: 'Time', width: 120 },
    { field: 'address', title: 'Address', minWidth: 160 }
  ],
  data: [
    { id: 10001, name: 'Test1', role: 'Develop', sex: 'Man Man Man', age: 28, address: 'test abc' },
    { id: 10002, name: 'Test2 Test2', role: 'Test Test Test Test Test Test', sex: 'Women', age: 22, address: 'Guangzhou' },
    { id: 10003, name: 'Test3', role: 'PM', sex: 'Man Man Man Man Man Man', age: 32, address: 'Shanghai' },
    { id: 10004, name: 'Test4', role: 'Designer Designer', sex: 'Women', age: 24, address: 'Shanghai' }
  ]
})
</script>

https://gitee.com/x-extends/vxe-table



来源:https://www.cnblogs.com/qaz666/p/18927321
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部