fix
设置页面资源
This commit is contained in:
@@ -31,12 +31,16 @@ export class DialogBubble extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
updateBubbleContent(str: string, callback?: (actualHeight: number) => void, isLoading: boolean = false) {
|
||||
updateBubbleContent(
|
||||
str: string,
|
||||
callback?: (actualHeight: number) => void,
|
||||
isLoading: boolean = false
|
||||
) {
|
||||
// 停止之前的加载动画
|
||||
this.stopLoadingAnimation();
|
||||
|
||||
|
||||
this.content.overflow = Overflow.NONE;
|
||||
|
||||
|
||||
// 如果是加载状态,使用固定的"..."
|
||||
if (isLoading && str === "...") {
|
||||
this.content.string = "...";
|
||||
@@ -44,13 +48,13 @@ export class DialogBubble extends Component {
|
||||
const contentWidth = 60;
|
||||
this.contentT.setContentSize(new Size(contentWidth, 40));
|
||||
this.bg.setContentSize(new Size(contentWidth + 30, 50));
|
||||
|
||||
|
||||
if (callback) {
|
||||
callback(40); // 返回固定高度
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 设置文本内容
|
||||
this.content.string = str;
|
||||
|
||||
@@ -75,7 +79,7 @@ export class DialogBubble extends Component {
|
||||
|
||||
// 设置内容区域宽度,让Label自动计算高度
|
||||
this.contentT.setContentSize(new Size(contentWidth, 0));
|
||||
this.bg.setContentSize(new Size(contentWidth + 17, 0));
|
||||
this.bg.setContentSize(new Size(contentWidth + 37, 0));
|
||||
|
||||
// 强制更新Label的渲染数据以获取正确的高度
|
||||
this.content.updateRenderData(true);
|
||||
@@ -90,7 +94,7 @@ export class DialogBubble extends Component {
|
||||
|
||||
// 根据内容大小调整背景大小,添加适当的内边距
|
||||
//const bgHeight = actualHeight + 17;
|
||||
this.bg.setContentSize(new Size(actualSize.x + 30, actualSize.y + 10));
|
||||
this.bg.setContentSize(new Size(actualSize.x + 40, actualSize.y + 30));
|
||||
|
||||
// 回调通知实际高度
|
||||
if (callback) {
|
||||
|
||||
Reference in New Issue
Block a user