diff --git a/example/pages/steps/index.js b/example/pages/steps/index.js
index 44f710e7..84985871 100644
--- a/example/pages/steps/index.js
+++ b/example/pages/steps/index.js
@@ -1,32 +1,40 @@
import Page from '../../common/page';
import Toast from '../../dist/toast/toast';
+import icons from '../../dist/@vant/icons/src/config';
+
+const steps = [
+ {
+ text: '步骤一',
+ desc: '描述信息',
+ },
+ {
+ text: '步骤二',
+ desc: '描述信息',
+ },
+ {
+ text: '步骤三',
+ desc: '描述信息',
+ },
+ {
+ text: '步骤四',
+ desc: '描述信息',
+ },
+];
Page({
data: {
active: 1,
- steps: [
- {
- text: '步骤一',
- desc: '描述信息'
- },
- {
- text: '步骤二',
- desc: '描述信息'
- },
- {
- text: '步骤三',
- desc: '描述信息'
- },
- {
- text: '步骤四',
- desc: '描述信息'
- }
- ]
+ steps,
+ customIconSteps: steps.map((item, index) => ({
+ ...item,
+ inactiveIcon: icons.outline[index],
+ activeIcon: icons.basic[index],
+ })),
},
nextStep() {
this.setData({
- active: ++this.data.active % 4
+ active: ++this.data.active % 4,
});
},
diff --git a/example/pages/steps/index.wxml b/example/pages/steps/index.wxml
index c351b839..5bb24f6b 100644
--- a/example/pages/steps/index.wxml
+++ b/example/pages/steps/index.wxml
@@ -2,6 +2,7 @@
@@ -18,6 +19,13 @@
/>
+
+
+
+
-
-
-
- 下一步
-
-
diff --git a/packages/steps/README.md b/packages/steps/README.md
index b48a1e82..b344e82f 100644
--- a/packages/steps/README.md
+++ b/packages/steps/README.md
@@ -56,6 +56,47 @@ Page({
/>
```
+### 自定义图标
+
+可以通过 `inactiveIcon` 和 `activeIcon` 属性分别设置每一项的图标
+
+```html
+
+```
+
+```javascript
+Page({
+ data: {
+ steps: [
+ {
+ text: '步骤一',
+ desc: '描述信息',
+ inactiveIcon: 'location-o',
+ activeIcon: 'success',
+ },
+ {
+ text: '步骤二',
+ desc: '描述信息',
+ inactiveIcon: 'like-o',
+ activeIcon: 'plus',
+ },
+ {
+ text: '步骤三',
+ desc: '描述信息',
+ inactiveIcon: 'star-o',
+ activeIcon: 'cross',
+ },
+ {
+ text: '步骤四',
+ desc: '描述信息',
+ inactiveIcon: 'phone-o',
+ activeIcon: 'fail',
+ },
+ ],
+ },
+});
+```
+
### 竖向步骤条
可以通过设置`direction`属性来改变步骤条的显示方式
diff --git a/packages/steps/index.wxml b/packages/steps/index.wxml
index af31094f..6180b417 100644
--- a/packages/steps/index.wxml
+++ b/packages/steps/index.wxml
@@ -17,9 +17,9 @@
-
+