Browse Source

增加标题中间文字备注

胡玲 1 month ago
parent
commit
e2324ecbdc
1 changed files with 24 additions and 16 deletions
  1. 24 16
      src/main/ets/view/SafeView.ets

+ 24 - 16
src/main/ets/view/SafeView.ets

@@ -44,6 +44,8 @@ export struct SafeView {
   // 设置返回按钮事件
   @Prop onClickLeft: TitleBarBtn
   @Prop onClickRight: TitleBarBtn
+  // 设置导航栏底下标题
+  @Prop bottomTitleText: ResourceStr
 
   @Builder
   doNothingBuilder() {
@@ -90,18 +92,24 @@ export struct SafeView {
               }
             })
 
-            Text(this.titleText ?? '')
-              .maxLines(1)
-              .fontColor(this.titleColor ?? '#11102C')
-              .fontSize(16)
-              .fontWeight(FontWeight.Medium)
-              .ellipsisMode(EllipsisMode.CENTER)
-              .textOverflow({
-                overflow: TextOverflow.Ellipsis
-              })
-              .constraintSize({
-                maxWidth: 200
-              })
+            Column() {
+              Text(this.titleText ?? '')
+                .maxLines(1)
+                .fontColor(this.titleColor ?? '#11102C')
+                .fontSize(16)
+                .fontWeight(FontWeight.Medium)
+                .ellipsisMode(EllipsisMode.CENTER)
+                .textOverflow({
+                  overflow: TextOverflow.Ellipsis
+                })
+                .constraintSize({
+                  maxWidth: 200
+                })
+
+              if (this.bottomTitleText) {
+                Text(this.bottomTitleText ?? '').fontColor('#CB8204').fontSize(12).margin({ top: 4 })
+              }
+            }
 
             Row() {
               if (!this.onClickLeft?.img && this.onClickLeft) {
@@ -110,7 +118,7 @@ export struct SafeView {
                   style: {
                     badgeSize: 6,
                     badgeColor: Color.Red,
-                    fontSize:1,
+                    fontSize: 1,
                     color: '#FF6500',
                   }
                 }) {
@@ -128,7 +136,7 @@ export struct SafeView {
                     badgeSize: 6,
                     badgeColor: '#FF6500',
                     color: '#FF6500',
-                    fontSize:1
+                    fontSize: 1
                   }
                 }) {
                   Image(this.onClickLeft.img)
@@ -147,7 +155,7 @@ export struct SafeView {
                     badgeSize: 6,
                     badgeColor: '#FF6500',
                     color: '#FF6500',
-                    fontSize:1
+                    fontSize: 1
                   }
                 }) {
                   Text(this.onClickRight?.text ?? '确定')
@@ -167,7 +175,7 @@ export struct SafeView {
                     badgeSize: 6,
                     badgeColor: '#FF6500',
                     color: '#FF6500',
-                    fontSize:1
+                    fontSize: 1
                   }
                 }) {
                   Image(this.onClickRight.img)