How to specify the width of a column in a table, and enable automatic line wrapping based on the width limit, while allowing the height of the cells to be determined by the actual number of content lines.
How can I achieve this effect on a table component?
In VTable, add the following configuration to the table options.
heightMode: 'autoHeight', // the height of each row is determined by the content and will expand accordingly.
autoWrapText: true, // Enable automatic line wrapping.
2
Answers
You need to specify the
width
of your choice and add theword-break: break-all;
rule:Solution
In VTable, add the following configuration to the table options.
Code Example
Results
Online demo:https://codesandbox.io/s/vtable-autoheight-dktrk4
Related Documentation
Auto wrap Demo:https://visactor.io/vtable/demo/basic-functionality/auto-wrap-text
Auto wrap Tutorial:https://visactor.io/vtable/guide/basic_function/auto_wrap_text
Related api:
https://visactor.io/vtable/option/ListTable#autoWrapText
https://visactor.io/vtable/option/ListTable#heightMode
github:https://github.com/VisActor/VTable