Compare commits

...

4 Commits

Author SHA1 Message Date
chenjiahan
1046dec256 chore: release 2.12.48 2022-06-25 12:34:48 +08:00
AmazingPromise
91ef58aac1
fix(List): element with overflow: overlay style should be considered a scroll container (#10743) 2022-06-25 11:44:11 +08:00
chenjiahan
60bf564c7f chore(Steps): rename unreleased center prop 2022-06-19 16:17:52 +08:00
绯色琉璃
673aec052c
feat(Steps): add align-center prop (#10617)
* 添加steps组件alignCenter 的属性

* 设置steps 的 alignCenter在横向时无效

* 修改 Steps API Doc

* 格式化setp代码,并删除无用注释
2022-06-19 16:05:28 +08:00
6 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "2.12.47",
"version": "2.12.48",
"description": "Mobile UI Components built on Vue",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -23,10 +23,22 @@ export default createComponent({
},
lineStyle() {
if (this.status === 'finish') {
return { background: this.parent.activeColor };
const { activeColor, inactiveColor, center, direction } = this.parent;
const style = {
background: this.status === 'finish' ? activeColor : inactiveColor,
};
if (center && direction === 'vertical') {
style.top = '50%';
}
return style;
},
circleContainerStyle() {
if (this.parent.center && this.parent.direction === 'vertical') {
return {
top: '50%',
};
}
return { background: this.parent.inactiveColor };
},
titleStyle() {
@ -111,7 +123,11 @@ export default createComponent({
>
{this.slots()}
</div>
<div class={bem('circle-container')} onClick={this.onClickStep}>
<div
class={bem('circle-container')}
onClick={this.onClickStep}
style={this.circleContainerStyle}
>
{this.genCircle()}
</div>
<div class={bem('line')} style={this.lineStyle} />

View File

@ -77,6 +77,7 @@ export default {
| inactive-icon | Inactive icon name | _string_ | - |
| finish-icon `v2.12.7` | Finish icon name | _string_ | - |
| icon-prefix `v2.12.15` | Icon className prefix | _string_ | `van-icon` |
| center | Whether to center content when direction is vertical | _boolean_ | `false` |
### Step Slots

View File

@ -87,6 +87,7 @@ export default {
| inactive-icon | 未激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
| finish-icon `v2.12.7` | 已完成步骤对应的底部图标,优先级高于 `inactive-icon`,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
| icon-prefix `v2.12.15` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| center | 是否进行居中对齐,仅在竖向展示时有效 | _boolean_ | `false` |
### Step Slots

View File

@ -7,6 +7,7 @@ export default createComponent({
mixins: [ParentMixin('vanSteps')],
props: {
center: Boolean,
iconPrefix: String,
finishIcon: String,
activeColor: String,

View File

@ -6,7 +6,7 @@ function isWindow(val: unknown): val is Window {
// get nearest scroll element
// https://github.com/youzan/vant/issues/3823
const overflowScrollReg = /scroll|auto/i;
const overflowScrollReg = /scroll|auto|overlay/i;
export function getScroller(el: HTMLElement, root: ScrollElement = window) {
let node = el;