mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Step: add inactive-icon slot
This commit is contained in:
parent
4d4ad7960b
commit
e9e6e238db
@ -75,6 +75,7 @@
|
|||||||
### Steps
|
### Steps
|
||||||
|
|
||||||
- 新增`inactive-icon`属性
|
- 新增`inactive-icon`属性
|
||||||
|
- 新增`inactive-icon`插槽
|
||||||
|
|
||||||
### SwitchCell
|
### SwitchCell
|
||||||
|
|
||||||
|
@ -43,8 +43,9 @@ export default sfc({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inactiveIcon) {
|
const inactiveIconSlot = slots('inactive-icon');
|
||||||
return <Icon class={bem('icon')} name={inactiveIcon} />;
|
if (inactiveIcon || inactiveIconSlot) {
|
||||||
|
return inactiveIconSlot || <Icon class={bem('icon')} name={inactiveIcon} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <i class={bem('circle')} />;
|
return <i class={bem('circle')} />;
|
||||||
|
@ -79,4 +79,5 @@ export default {
|
|||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|------|------|
|
|------|------|
|
||||||
| icon | Custom icon |
|
| active-icon | Custom active icon |
|
||||||
|
| inactive-icon | Custom inactive icon |
|
||||||
|
29
packages/steps/test/__snapshots__/index.spec.js.snap
Normal file
29
packages/steps/test/__snapshots__/index.spec.js.snap
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`icon slot 1`] = `
|
||||||
|
<div class="van-steps van-steps--horizontal">
|
||||||
|
<div class="van-steps__items">
|
||||||
|
<div class="van-hairline van-step van-step--horizontal van-step--finish">
|
||||||
|
<div class="van-step__title">
|
||||||
|
A
|
||||||
|
</div>
|
||||||
|
<div class="van-step__circle-container">Custim Inactive Icon</div>
|
||||||
|
<div class="van-step__line"></div>
|
||||||
|
</div>
|
||||||
|
<div class="van-hairline van-step van-step--horizontal van-step--process">
|
||||||
|
<div class="van-step__title" style="color: rgb(7, 193, 96);">
|
||||||
|
B
|
||||||
|
</div>
|
||||||
|
<div class="van-step__circle-container">Custim Active Icon</div>
|
||||||
|
<div class="van-step__line"></div>
|
||||||
|
</div>
|
||||||
|
<div class="van-hairline van-step van-step--horizontal">
|
||||||
|
<div class="van-step__title">
|
||||||
|
C
|
||||||
|
</div>
|
||||||
|
<div class="van-step__circle-container">Custim Inactive Icon</div>
|
||||||
|
<div class="van-step__line"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
29
packages/steps/test/index.spec.js
Normal file
29
packages/steps/test/index.spec.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { mount } from '../../../test/utils';
|
||||||
|
import Steps from '..';
|
||||||
|
import Step from '../../step';
|
||||||
|
|
||||||
|
test('icon slot', () => {
|
||||||
|
const wrapper = mount({
|
||||||
|
template: `
|
||||||
|
<steps :active="1">
|
||||||
|
<step>
|
||||||
|
<template v-slot:inactive-icon>Custim Inactive Icon</template>
|
||||||
|
A
|
||||||
|
</step>
|
||||||
|
<step>
|
||||||
|
<template v-slot:active-icon>Custim Active Icon</template>
|
||||||
|
B
|
||||||
|
</step>
|
||||||
|
<step>
|
||||||
|
<template v-slot:inactive-icon>Custim Inactive Icon</template>
|
||||||
|
C
|
||||||
|
</step>
|
||||||
|
</steps>
|
||||||
|
`,
|
||||||
|
components: {
|
||||||
|
Steps,
|
||||||
|
Step
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
@ -83,3 +83,4 @@ export default {
|
|||||||
| 名称 | 说明 |
|
| 名称 | 说明 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| active-icon | 自定义激活状态图标 |
|
| active-icon | 自定义激活状态图标 |
|
||||||
|
| inactive-icon | 自定义未激活状态图标 |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user