[Vuejs]-Vue3 model updates initially after saving code, but not after a browser refresh

1👍

Parts of your code only use initialData contrary to what you might think. Pay attention to the code below.

  data() {
    return {
      item: {...this.input},
    }
  },

In the above code, you will only have the initial value of the input and you will lose the other values.
The easiest way to use props is to use them directly.

However, for more complex concepts, you can use computed or toRef, etc.

Try the code below

              <v-text-field v-else
                @change="updateValue(field.name, $event)"
                persistent-placeholder
                :model-value="input[field.name]"
                :label="field.title || field.name"
              ></v-text-field>
props: {
    input: {
      type: Object ,
      default: () => {}
    },
  },
👤m kh

Leave a comment