Victor 直接上代码label.width = NaN; label.text = "set the label width to NaN before set text pro"; console.log(label.width); 在ui里可以不设置Label对象的wdith属性达到自适应宽度的效果(不设置属性不等于设置属性为0)