Skip to content

Commit

Permalink
fix(layer): 改进 maxWidth 和 maxHeight 的处理 (layui#2270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sight-wcg authored Oct 11, 2024
1 parent 18e0143 commit 0a532f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/layer/detail/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ layer.open({
<td>maxWidth</td>
<td>

弹层的最大宽度。当 `area` 属性值为默认的 `auto'` 时有效
弹层的最大宽度。当 `area` 属性设置宽度自适应时有效

</td>
<td>number</td>
Expand All @@ -167,7 +167,7 @@ layer.open({
<td>maxHeight</td>
<td>

弹层的最大高度。当 `area` 属设置高度自适应时有效
弹层的最大高度。当 `area` 属性设置高度自适应时有效

</td>
<td>number</td>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ Class.pt.resize = function(){
Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);

if(config.area[0] === '' && config.maxWidth > 0){
if((config.area[0] === '' || config.area[0] === 'auto') && config.maxWidth > 0){
// 适配 ie7
if(layer.ie && layer.ie < 8 && config.btn){
layero.width(layero.innerWidth());
Expand All @@ -579,7 +579,7 @@ Class.pt.auto = function(index){
setHeight('iframe');
break;
default:
if(config.area[1] === ''){
if(config.area[1] === '' || config.area[1] === 'auto'){
if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){
area[1] = config.maxHeight;
setHeight('.'+doms[5]);
Expand Down

0 comments on commit 0a532f3

Please sign in to comment.