步骤条和按钮联动(上一步下一步)

ops/2025/2/12 17:31:14/

 

ImportMatchDrawer.vue

javascript"><template><div class="import-drawer"><Drawer :title="props.titleName" ref="drawer" size="648"><!-- 内容 --><template #content><!-- 步骤条 --><CustomStep :step-data="stepData" :current-step="currentStep" /><div class="create-single-product-promotion-form"><!-- 第一步 --><StepOne :currentStep="currentStep" /><!-- 第二步 --><StepTwo :currentStep="currentStep" /></div></template><!-- 按钮 --><template #foot_button><el-button>取消</el-button><el-button v-if="currentStep !== 1" @click="stepChange('prev')">上一步</el-button><el-button type="primary" @click="stepChange('next')">{{currentStep !== 2 ? "下一步" : "保存"}}</el-button></template></Drawer></div>
</template><script lang="ts" setup>
import { ref } from "vue"
import Drawer from "@/components/common/Drawer.vue"
import StepOne from "./stepOne.vue"
import StepTwo from "./stepTwo.vue"
import CustomStep from "./customStep.vue"const props = defineProps({type: {type: Number,default: 0},titleName: {type: String,default: ""},warn: {type: String,default: ""}
})
const currentStep = ref<any>(1) // 当前步骤
const stepData = ref<any[]>([// 步骤数据{ id: 1, title: "上传文件" },{ id: 2, title: "匹配字段" }
])// 弹框DOM
const drawer = ref<InstanceType<typeof Drawer> | null>(null)// 打开
const open = () => {drawer.value?.isOpen()
}// 步切换
const stepChange = (type: any) => {if (type == "prev") {currentStep.value = Math.max(1, currentStep.value - 1)} else {if (currentStep.value === 2) {return}currentStep.value = Math.min(2, currentStep.value + 1)}
}defineExpose({open
})
</script><style lang="scss" scoped></style>

 CustomStep.vue

javascript"><template><div class="custom-step"><el-steps :active="currentStep" simple><template v-for="step in stepData" :key="step.id"><el-step:title="step.title":description="step.description":class="{ 'is-finish': step.id < currentStep }"><template #icon>{{ step.id }}</template></el-step></template></el-steps></div>
</template><script setup lang="ts">
import { defineProps, withDefaults } from "vue"defineProps({currentStep: {type: Number,default: 0},stepData: {type: Array<any>,default: () => []}
})
</script><style scoped lang="scss">
.custom-step {width: 60%;height: 62px;margin: 0 auto;:deep(.el-steps) {padding: 20px 40px;background-color: transparent;.el-step__head {&.is-finish {.el-step__icon {border: none;color: var(--el-color-white);background-color: var(--el-color-primary);}}.el-step__icon {width: 22px;height: 22px;font-weight: 600;font-size: 16px;border-radius: 50%;border: 1px solid #c2c4c6;}}.el-step__main {display: flex;align-items: center;.el-step__arrow {flex: 1;height: 2px;margin: 0 10px;background-color: #c2c4c6;&::before,&::after {display: none;}}}.is-finish {.el-step__arrow {background-color: var(--el-color-primary);}}}
}
</style>

StepOne.vue

javascript"><!-- eslint-disable vue/no-mutating-props -->
<template><div class="step-one-form" v-show="currentStep === 1"> 1 </div>
</template><script setup lang="ts">
const props = defineProps({currentStep: {type: Number,default: 1}
})
</script><style scoped lang="scss"></style>

StepTwo.vue

javascript"><!-- eslint-disable vue/no-mutating-props -->
<template><div class="step-one-form" v-show="currentStep === 2"> 2 </div>
</template><script setup lang="ts">
const props = defineProps({currentStep: {type: Number,default: 1}
})
</script><style scoped lang="scss"></style>


http://www.ppmy.cn/ops/157821.html

相关文章

如何使用 webpack 来优化前端性能的?

Webpack 是一个强大的现代 JavaScript 应用程序的模块打包工具。它不仅可以将 JavaScript 文件打包,还可以处理 CSS、图片等资源。通过合理配置 Webpack,可以显著优化前端性能。本文将详细探讨如何使用 Webpack 来优化前端性能,包括基本概念、优化策略和实践示例。 1. Webp…

运行npm install卡住不动的

首先检查npm代理&#xff0c;是否已经使用国内镜像 // 执行以下命令查看是否为国内镜像 npm config get registry 如果不是则换成国内镜像&#xff0c;执行以下命令 npm config set registryhttps://registry.npmmirror.com //执行以下命令查看是否配置成功 npm config get …

使用Qt+opencv实现游戏辅助点击工具-以阴阳师为例

注&#xff1a;本文章技术交流使用&#xff0c;不侵犯任何著作权。 一. 阴阳师辅助软件需要实现哪些功能? 1.首先&#xff0c;对于肝绘卷拿角色而言&#xff0c;需要打困难28副本和结界突破循环刷绘卷碎片。这一功能让你每月免费悠闲地拿到最新角色&#xff0c;即使你是较新…

Redis的数据过期策略和数据淘汰策略

一、数据过期策略 Redis的key过期之后&#xff0c;会立即删除吗&#xff1f; 是否立即删除&#xff0c;这是根据Redis的数据过期策略来决定的 Redis对数据设值数据的过期时间&#xff0c;数据过期后&#xff0c;就需要将数据从内存中删除掉。可以按照不同的规则进行删除&…

使用Jenkins、K8S、Docker一键部署SpringCloud微服务

集成Jenkins、Kubernetes&#xff08;K8S&#xff09;和Docker&#xff0c;实现一键部署SpringCloud微服务。以下是具体的步骤&#xff1a; 步骤一&#xff1a;配置Jenkins 首先&#xff0c;我们需要安装并配置Jenkins。Jenkins是一个开源的持续集成/持续部署工具&#xff0c;…

智慧机房解决方案(文末联系,领取整套资料,可做论文)

智慧机房解决方案-软件部分 一、方案概述 本智慧机房解决方案旨在通过硬件设备与软件系统的深度整合&#xff0c;实现机房的智能化管理与服务&#xff0c;提升机房管理人员的工作效率&#xff0c;优化机房运营效率&#xff0c;确保机房设备的安全稳定运行。软件部分包括机房管…

kafka消费端之再均衡

文章目录 再均衡是指分区的所属权从一个消费者转移到另一消费者的行为&#xff0c;它为消费组具备高可用性和伸缩性提供保障&#xff0c;使我们可以既方便又安全地删除消费组内的消费者或往消费组内添加消费者。不过 在再均衡发生期间&#xff0c;消费组内的消费者是无法读取消…

C语言——排序(冒泡,选择,插入)

基本概念 排序是对数据进行处理的常见操作&#xff0c;即将数据按某字段规律排列。字段是数据节点的一个属性&#xff0c;比如学生信息中的学号、分数等&#xff0c;可针对这些字段进行排序。同时&#xff0c;排序算法有稳定性之分&#xff0c;若两个待排序字段一致的数据在排序…