Skip to content

[bug report] error in default value of align attribute of El row element #20913

@xlfsummer

Description

@xlfsummer

Element UI version

2.15.1

OS/Browsers version

Vue version

2.6.12

Reproduction Link

https://jsfiddle.net/4vwt3mz0/11/

Steps to reproduce

<el-row /> 设置为 type=flex, 其中放置两个不同 size<el-button />

What is Expected?

size 更小的 el-button,其高度应该更小,并且因为 el-rowalign 属性默认值为 "top", 两个按钮应顶部对齐

What is actually happening?

两个按钮的对齐方式为 strech, 并且显式声明 el-rowalign 属性为 "top" 也不生效。

其他描述

根据 MDN, align-items 属性的默认值为 normal, 含义如下:

normal
The effect of this keyword is dependent of the layout mode we are in:

  • In absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes.
  • In static position of absolutely-positioned layouts, the keyword behaves as stretch.
  • For flex items, the keyword behaves as stretch.
  • For grid items, this keyword leads to a behavior similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start.
    The property doesn't apply to block-level boxes, and to table cells.

代码实现中,当 aligntop 时, 应将 align-items 属性设置为 flex-start, 而不是忽略:

render(h) {
return h(this.tag, {
class: [
'el-row',
this.justify !== 'start' ? `is-justify-${this.justify}` : '',
this.align !== 'top' ? `is-align-${this.align}` : '',
{ 'el-row--flex': this.type === 'flex' }
],
style: this.style
}, this.$slots.default);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions