diff --git a/src/components/WizardStep.vue b/src/components/WizardStep.vue index f057bdc..20461f3 100644 --- a/src/components/WizardStep.vue +++ b/src/components/WizardStep.vue @@ -1,15 +1,38 @@ @@ -18,7 +41,6 @@ import { ref, computed } from 'vue' import { useWizardStore } from '../store' import { NButton, NCheckbox } from 'naive-ui' -import Greet from './Greet.vue'; import PrerequisitiesCheck from './wizard_steps/PrerequisitiesCheck.vue'; import PythonSanitycheck from './wizard_steps/PythonSanitycheck.vue'; import TargetSelect from './wizard_steps/TargetSelect.vue'; @@ -28,61 +50,170 @@ import InstallationPathSelect from './wizard_steps/InstallationPathSelect.vue'; import InstalationProgress from './wizard_steps/InstalationProgress.vue'; import Complete from './wizard_steps/Complete.vue'; + export default { - components: { Complete, NButton, NCheckbox, Greet, PrerequisitiesCheck, PythonSanitycheck, TargetSelect, VersionSelect, MirrorSelect, InstallationPathSelect, InstalationProgress }, - setup() { - const store = useWizardStore() - - const steps = [ - { - title: "Prerequisities Check ", - }, - { - title: "Python Sanity check", - }, - { - title: "Select Target", - }, - { - title: "Select IDF Version", - }, - { - title: "Select mirror", - }, - { - title: "Select Installation Path", - }, - { - title: "Installation progress", - }, - { - title: "Instalation Complete", + name: 'WizardStep', + components: { + Complete, + NButton, + NCheckbox, + PrerequisitiesCheck, + PythonSanitycheck, + TargetSelect, + VersionSelect, + MirrorSelect, + InstallationPathSelect, + InstalationProgress, + }, + data() { + return { + steps: [ + { title: "Prerequisities Check" }, + { title: "Python Sanity check" }, + { title: "Select Target" }, + { title: "Select IDF Version" }, + { title: "Select mirror" }, + { title: "Select Installation Path" }, + { title: "Installation progress" }, + { title: "Instalation Complete" } + ] + } + }, + computed: { + store() { + return useWizardStore() + }, + currentStep() { + return this.store.currentStep + }, + totalSteps() { + return this.store.totalSteps + }, + stepTitle() { + return this.steps[this.store.currentStep - 1].title + } + }, + methods: { + initializeSteps() { + this.steps = [ + { title: "Prerequisities Check" }, + { title: "Python Sanity check" }, + { title: "Select Target" }, + { title: "Select IDF Version" }, + { title: "Select mirror" }, + { title: "Select Installation Path" }, + { title: "Installation progress" }, + { title: "Instalation Complete" } + ]; + }, + nextStep() { + if (this.store.currentStep === 1) { + // this.store.updateData({ deviceName: deviceName.value }) + } else if (this.store.currentStep === 2) { + // this.store.updateData({ connectionType: connectionType.value }) + } else if (this.store.currentStep === 3) { + // this.store.updateData({ confirmed: confirmInstall.value }) } - ]; // Add more steps as needed + this.store.nextStep() + }, + previousStep() { + this.store.previousStep() + }, + }, + onBeforeMount() { + this.store = useWizardStore(); + this.initializeSteps(); + } +} + - const stepTitle = computed(() => { - return steps[store.currentStep - 1].title - }) + \ No newline at end of file