Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

147
Vistas
Vue js my data lost after reloading my page

I have a page reload problem.
When I save on Vscode it works correctly on my html page, but when I refresh the page my data is undefined.
The data in the store works well, however it's just on the view profile that it doesn't work only after reloading my page.
If you have any suggestions, I'm a taker, I don't know what to do anymore.

views/Profil:

<div class="input-group mb-3">
            <span class="input-group-text" id="form-lastName">Nom :</span>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              v-model="lastName"
              ref="string"
            />
          </div>
          <div class="input-group mb-3">
            <span class="input-group-text" id="form-firstName">Prénom :</span>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              v-model="firstName"
              ref="string"
            />
          </div>


----------


export default {
  name: "ProfilC",
  data: function () {
    return {
      lastName: "",
      firstName: "",
      selectedFile: "",
    };
  },
  components: {
    NavbarC,
  },
  mounted: function () {
    this.lastName = this.$store.state.userInfos.user_lastName;
    this.firstName = this.$store.state.userInfos.user_firstName;


----------
sotre/index.js

const store = createStore({
  state: {
    status: '',
    user: user,
    userInfos: {
      nom: '',
      prenom: '',
      email: '',
      image: '',
    },
    dataArticles: [],
    dataComments: [],
    articleInfos: {
      message: '',
      image: '',
    },
    comments: [],
  },

  mutations: {
    
    userInfos: function (state, userInfos) {
      state.userInfos = userInfos;
    },
},

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I see your using vuex , did you install vuex persisted-state is saved the data on page reload

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos