mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Step): add @step-active-color less var
This commit is contained in:
parent
0011db7536
commit
9e7a687414
@ -17,16 +17,23 @@ export default createComponent({
|
|||||||
return 'process';
|
return 'process';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
active() {
|
||||||
|
return this.status === 'process';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
genCircle() {
|
genCircle() {
|
||||||
const { activeIcon, activeColor, inactiveIcon } = this.parent;
|
const { activeIcon, activeColor, inactiveIcon } = this.parent;
|
||||||
|
|
||||||
if (this.status === 'process') {
|
if (this.active) {
|
||||||
return (
|
return (
|
||||||
this.slots('active-icon') || (
|
this.slots('active-icon') || (
|
||||||
<Icon class={bem('icon')} name={activeIcon} color={activeColor} />
|
<Icon
|
||||||
|
class={bem('icon', 'active')}
|
||||||
|
name={activeIcon}
|
||||||
|
color={activeColor}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -44,13 +51,13 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { status } = this;
|
const { status, active } = this;
|
||||||
const { activeColor, direction } = this.parent;
|
const { activeColor, direction } = this.parent;
|
||||||
const titleStyle = status === 'process' && { color: activeColor };
|
const titleStyle = active && { color: activeColor };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={[BORDER, bem([direction, { [status]: status }])]}>
|
<div class={[BORDER, bem([direction, { [status]: status }])]}>
|
||||||
<div class={bem('title')} style={titleStyle}>
|
<div class={bem('title', { active })} style={titleStyle}>
|
||||||
{this.slots()}
|
{this.slots()}
|
||||||
</div>
|
</div>
|
||||||
<div class={bem('circle-container')}>{this.genCircle()}</div>
|
<div class={bem('circle-container')}>{this.genCircle()}</div>
|
||||||
|
@ -138,4 +138,11 @@
|
|||||||
background-color: @step-finish-line-color;
|
background-color: @step-finish-line-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__icon,
|
||||||
|
&__title {
|
||||||
|
&--active {
|
||||||
|
color: @step-active-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
import { GREEN } from '../utils/constant';
|
|
||||||
import { ParentMixin } from '../mixins/relation';
|
import { ParentMixin } from '../mixins/relation';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('steps');
|
const [createComponent, bem] = createNamespace('steps');
|
||||||
@ -8,6 +7,7 @@ export default createComponent({
|
|||||||
mixins: [ParentMixin('vanSteps')],
|
mixins: [ParentMixin('vanSteps')],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
activeColor: String,
|
||||||
inactiveIcon: String,
|
inactiveIcon: String,
|
||||||
active: {
|
active: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -17,10 +17,6 @@ export default createComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'horizontal',
|
default: 'horizontal',
|
||||||
},
|
},
|
||||||
activeColor: {
|
|
||||||
type: String,
|
|
||||||
default: GREEN,
|
|
||||||
},
|
|
||||||
activeIcon: {
|
activeIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'checked',
|
default: 'checked',
|
||||||
|
@ -11,8 +11,8 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
||||||
<div class="van-step__title" style="color: rgb(7, 193, 96);">商家接单</div>
|
<div class="van-step__title van-step__title--active">商家接单</div>
|
||||||
<div class="van-step__circle-container"><i class="van-icon van-icon-checked van-step__icon" style="color: rgb(7, 193, 96);">
|
<div class="van-step__circle-container"><i class="van-icon van-icon-checked van-step__icon van-step__icon--active">
|
||||||
<!----></i></div>
|
<!----></i></div>
|
||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,8 +39,8 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
||||||
<div class="van-step__title" style="color: rgb(51, 136, 255);">商家接单</div>
|
<div class="van-step__title van-step__title--active" style="color: rgb(51, 136, 255);">商家接单</div>
|
||||||
<div class="van-step__circle-container"><i class="van-icon van-icon-success van-step__icon" style="color: rgb(51, 136, 255);">
|
<div class="van-step__circle-container"><i class="van-icon van-icon-success van-step__icon van-step__icon--active" style="color: rgb(51, 136, 255);">
|
||||||
<!----></i></div>
|
<!----></i></div>
|
||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,11 +63,11 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div class="van-steps van-steps--vertical">
|
<div class="van-steps van-steps--vertical">
|
||||||
<div class="van-steps__items">
|
<div class="van-steps__items">
|
||||||
<div class="van-hairline van-step van-step--vertical van-step--process">
|
<div class="van-hairline van-step van-step--vertical van-step--process">
|
||||||
<div class="van-step__title" style="color: rgb(7, 193, 96);">
|
<div class="van-step__title van-step__title--active">
|
||||||
<h3>【城市】物流状态1</h3>
|
<h3>【城市】物流状态1</h3>
|
||||||
<p>2016-07-12 12:40</p>
|
<p>2016-07-12 12:40</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-step__circle-container"><i class="van-icon van-icon-checked van-step__icon" style="color: rgb(7, 193, 96);">
|
<div class="van-step__circle-container"><i class="van-icon van-icon-checked van-step__icon van-step__icon--active">
|
||||||
<!----></i></div>
|
<!----></i></div>
|
||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,7 +11,7 @@ exports[`icon slot 1`] = `
|
|||||||
<div class="van-step__line"></div>
|
<div class="van-step__line"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
||||||
<div class="van-step__title" style="color: rgb(7, 193, 96);">
|
<div class="van-step__title van-step__title--active">
|
||||||
B
|
B
|
||||||
</div>
|
</div>
|
||||||
<div class="van-step__circle-container">Custim Active Icon</div>
|
<div class="van-step__circle-container">Custim Active Icon</div>
|
||||||
|
@ -611,6 +611,7 @@
|
|||||||
|
|
||||||
// Step
|
// Step
|
||||||
@step-text-color: @gray-6;
|
@step-text-color: @gray-6;
|
||||||
|
@step-active-color: @green;
|
||||||
@step-process-text-color: @text-color;
|
@step-process-text-color: @text-color;
|
||||||
@step-font-size: @font-size-md;
|
@step-font-size: @font-size-md;
|
||||||
@step-line-color: @border-color;
|
@step-line-color: @border-color;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user