|
|
@@ -1,26 +1,41 @@
|
|
|
<template>
|
|
|
- <div class="demo">
|
|
|
+ <div class="demo padding">
|
|
|
<h2>基本用法</h2>
|
|
|
- <nut-steps current="1">
|
|
|
- <nut-step title="进行中">1</nut-step>
|
|
|
- <nut-step title="未开始">2</nut-step>
|
|
|
- <nut-step title="未开始">3</nut-step>
|
|
|
- <nut-step title="未开始">4</nut-step>
|
|
|
- </nut-steps>
|
|
|
+ <div class="steps-wrapper">
|
|
|
+ <nut-steps :current="current1">
|
|
|
+ <nut-step title="步骤一">1</nut-step>
|
|
|
+ <nut-step title="步骤二">2</nut-step>
|
|
|
+ <nut-step title="步骤三">3</nut-step>
|
|
|
+ </nut-steps>
|
|
|
+ <div class="steps-button">
|
|
|
+ <nut-button type="danger" @click="handleStep('current1')"
|
|
|
+ >下一步</nut-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<h2>标题和描述信息</h2>
|
|
|
- <nut-steps current="2">
|
|
|
- <nut-step title="已完成" content="步骤描述">1</nut-step>
|
|
|
- <nut-step title="进行中" content="步骤描述"></nut-step>
|
|
|
- <nut-step title="未开始" content="步骤描述"></nut-step>
|
|
|
- </nut-steps>
|
|
|
+ <div class="steps-wrapper">
|
|
|
+ <nut-steps :current="current2">
|
|
|
+ <nut-step title="步骤一" content="步骤描述">1</nut-step>
|
|
|
+ <nut-step title="步骤二" content="步骤描述"></nut-step>
|
|
|
+ <nut-step title="步骤三" content="步骤描述"></nut-step>
|
|
|
+ </nut-steps>
|
|
|
+ <div class="steps-button" style="margin-top: 10px">
|
|
|
+ <nut-button type="danger" @click="handleStep('current2')"
|
|
|
+ >下一步</nut-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<h2>自定义图标</h2>
|
|
|
- <nut-steps current="1">
|
|
|
- <nut-step title="已完成" icon="notice">1</nut-step>
|
|
|
- <nut-step title="进行中" icon="notice">2</nut-step>
|
|
|
- <nut-step class="nut-step-wait" title="未开始" icon="notice">3</nut-step>
|
|
|
- </nut-steps>
|
|
|
+ <div class="steps-wrapper">
|
|
|
+ <nut-steps current="1">
|
|
|
+ <nut-step title="已完成" icon="service">1</nut-step>
|
|
|
+ <nut-step title="进行中" icon="people">2</nut-step>
|
|
|
+ <nut-step title="未开始" icon="location2">3</nut-step>
|
|
|
+ </nut-steps>
|
|
|
+ </div>
|
|
|
<h2>竖向步骤条</h2>
|
|
|
- <div style="height: 300px; padding: 0 20px">
|
|
|
+ <div class="steps-wrapper" style="height: 300px; padding: 15px 30px">
|
|
|
<nut-steps direction="vertical" current="2">
|
|
|
<nut-step title="已完成" content="您的订单已经打包完成,商品已发出"
|
|
|
>1</nut-step
|
|
|
@@ -33,7 +48,8 @@
|
|
|
>
|
|
|
</nut-steps>
|
|
|
</div>
|
|
|
- <div style="height: 300px; padding: 0 20px">
|
|
|
+ <h2>竖向步骤条</h2>
|
|
|
+ <div class="steps-wrapper" style="height: 300px; padding: 15px 40px">
|
|
|
<nut-steps direction="vertical" progress-dot current="2">
|
|
|
<nut-step title="已完成" content="您的订单已经打包完成,商品已发出"
|
|
|
>1</nut-step
|
|
|
@@ -50,17 +66,47 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
+import { reactive, toRefs } from 'vue';
|
|
|
import { createComponent } from '../../utils/create';
|
|
|
const { createDemo } = createComponent('steps');
|
|
|
export default createDemo({
|
|
|
props: {},
|
|
|
setup() {
|
|
|
- return {};
|
|
|
+ const state = reactive({
|
|
|
+ current1: 1,
|
|
|
+ current2: 1,
|
|
|
+ current3: 1,
|
|
|
+ current4: 1,
|
|
|
+ current5: 1
|
|
|
+ });
|
|
|
+
|
|
|
+ const handleStep = (params) => {
|
|
|
+ if (state[params] >= 3) {
|
|
|
+ state[params] = 1;
|
|
|
+ } else {
|
|
|
+ state[params] += 1;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...toRefs(state),
|
|
|
+ handleStep
|
|
|
+ };
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-.demo-box {
|
|
|
+.padding {
|
|
|
+ padding-left: 0 !important;
|
|
|
+ padding-right: 0 !important;
|
|
|
+}
|
|
|
+.steps-wrapper {
|
|
|
+ width: 100%;
|
|
|
+ padding: 15px 0;
|
|
|
+ background-color: #fff;
|
|
|
+ .steps-button {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|