智能客服
你问我答,随时在线为你解决问题
页面底部的弹窗内容显示不全。

排查应用半模态面板高度设置是否合理。检查bindSheet属性中height的值。如果高度设置不合理,就会导致页面底部弹窗显示不全。
- build() {
- Column() {
- Button('bindSheet测试')
- .onClick(()=>{
- this.isShow = true
- })
- .bindSheet($$this.isShow, this.settingBuilder, {
- height: 65, // 高度设置不合理导致显示不全
- backgroundColor: Color.White,
- })
- }
- .height('100%')
- .width('100%')
- .backgroundColor(Color.Gray)
- .padding({top: 50, bottom: 50})
- }
半模态面板高度不足以容纳全部内容,导致底部内容被截断,显示不全。
建议调整半模态面板高度,尽量使用百分比高度,将半模态页面完整展示出来。同时给半模态页面添加Scroll组件,可以上下滑动查看页面内容。
- @Entry
- @Component
- struct TestDemo {
- @Builder
- settingBuilder() {
- Setting();
- }
-
- @State isShow: boolean = false; // 控制模态窗显隐状态
-
- build() {
- Column() {
- Button('bindSheet测试')
- .margin({ top: 60 })
- .onClick(() => {
- this.isShow = true;
- })
- .bindSheet($$this.isShow, this.settingBuilder, {
- height: '55%',
- backgroundColor: Color.White,
- });
- }
- .height('100%')
- .width('100%')
- .backgroundColor(Color.White);
- }
- }
-
- @Component
- struct Setting {
- private item: string[] = [];
-
- aboutToAppear(): void {
- for (let index = 1; index <= 30; index++) {
- this.item.push(`设置${index}`);
- }
- }
-
- build() {
- Column() {
- Row() {
- Text('标题')
- .fontWeight(FontWeight.Bold)
- .fontSize(25)
- .margin({ left: 16, top: 30 });
- }
- .justifyContent(FlexAlign.Start)
- .width('100%');
-
- Scroll() {
- Column() {
- ForEach(this.item, (item: string) => {
- Row() {
- Text(item);
- Checkbox();
- }
- .justifyContent(FlexAlign.SpaceBetween)
- .width('100%')
- .height(60);
-
- Divider()
- .width('100%');
- });
- }
- .justifyContent(FlexAlign.Start)
- .constraintSize({ minHeight: '100%' })
- .width('100%')
- .padding({ left: 16, right: 16, top: 10 });
- }
- .width('100%')
- .scrollBar(BarState.Off)
- .layoutWeight(1);
- }
- .width('100%');
- }
- }
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功