Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望modal能使用高度百分比 #18738

Closed
1 task
nlx0201 opened this issue Sep 9, 2019 · 6 comments
Closed
1 task

希望modal能使用高度百分比 #18738

nlx0201 opened this issue Sep 9, 2019 · 6 comments
Assignees

Comments

@nlx0201
Copy link

nlx0201 commented Sep 9, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

modal无法设置高度百分比,导致modal高度超出页面高度

What does the proposed API look like?

height="70%"

@ycjcl868
Copy link
Contributor

ycjcl868 commented Sep 9, 2019

手动用样式控制下内容区域的高度:

        <Modal
          title="20px to Top"
          visible={this.state.modal1Visible}
          onOk={() => this.setModal1Visible(false)}
          onCancel={() => this.setModal1Visible(false)}
        >
+       <div style={{ height: '60vh', overflowY: 'auto' }}>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>

            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
+       </div> 
        </Modal>

@ycjcl868 ycjcl868 closed this as completed Sep 9, 2019
@nlx0201
Copy link
Author

nlx0201 commented Sep 9, 2019

试过

手动用样式控制下内容区域的高度:

        <Modal
          title="20px to Top"
          visible={this.state.modal1Visible}
          onOk={() => this.setModal1Visible(false)}
          onCancel={() => this.setModal1Visible(false)}
        >
+       <div style={{ height: '60vh', overflowY: 'auto' }}>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>

            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
            <p>some contents...</p><p>some contents...</p>
+       </div> 
        </Modal>

试过,但是没有用处,主要是外部modal无法设置高度,内部设置百分比没有参考依据,所以无法生效

@ycjcl868
Copy link
Contributor

ycjcl868 commented Sep 9, 2019

Modal 的高度根据内部来的

@nlx0201
Copy link
Author

nlx0201 commented Sep 10, 2019

你可以尝试下,内部高度使用百分比是无效的,这个时候modal的高度会自适应。问题在于当我在一个页面使用modal的时候,我并不知道用户浏览器是多高,所以如果设置modal内部内容的高度的话,会导致页面内部出现一个滚动条,modal自身也会出现滚动条,滚动鼠标滑轮的时候两者会同时滚动,体验效果不好

@afc163
Copy link
Member

afc163 commented Sep 10, 2019

可以使用 height: calc(100vh - 200px)

@nlx0201
Copy link
Author

nlx0201 commented Sep 10, 2019

希望增加一个可以设置modal整体高度百分比的属性,类似width的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants