在计算多行文本高度的时候需要用constraintWidth给被测算的文本设置宽度,这样文本超长时字体引擎才知道有多宽时换行,使用只有在设置了constraintWidth的情况下,maxLine是生效的。参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-measure-V5\#measureoptions
在计算多行文本高度的时候需要用constraintWidth给被测算的文本设置宽度,这样文本超长时字体引擎才知道有多宽时换行,使用只有在设置了constraintWidth的情况下,maxLine是生效的。
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-measure-V5\#measureoptions