Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Best way to save progress in Vue.js project

I'm currently messing with someone else's project on Vue.js. The project is a webpage in php that asks for the user for his info. Then there is a series of exercises built with vue.js and in the end the results are stored in an excel file.

I've understood the layout of the project and how it works but I have a problem trying to add a new feature. I want to be able to save current progress in the exercises so that someone can continue from the exercise he was last time he opened the page. Every exercise has this code at the end:

handleSubmit(e) {
        e.preventDefault()

        for (let i = 0; i < e.target.length - 1; i++) {
            if (e.target[i].tagName === 'INPUT') {
                const result = {
                    id: e.target[i].id,
                    value: e.target[i].value,
                    exNumber: this.exNumber,
                }

                this.answers.push(result)
            }
        }

        this.addNewAnswer(this.answers)

so everything is added in a object.

At the last exercise there is this code:

const dataToPost = {
            name: this.name,
            age: this.age,
            birthday: this.birthday,
            city: this.city,
            gender: this.gender,
            loginDate: this.loginDate,
            exTimes: this.exTimes,
            totalTime: finalTime.toString(),
            class: classNumber,
            answers: this.finalScores,
        }

        this.axios
            .post(
                'http://***********/setAnswers.php',
                JSON.stringify(dataToPost)
            )
            .then((response) => {
                alert(response.data)
                router.push('/main')
            })

and sends all the answers from all the exercises to another php file that creates the excel file.

What would be the best way to handle state save between each exercise.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use localstorage to store the form.

https://fr.vuejs.org/v2/cookbook/client-side-storage.html

And there is an exemple here :

How to update object in local storage in vue js?

You have to stringify and parse the object to respectively store and retrieve it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda