Vuejs 2, VUEX, data-binding when editing data

前端 未结 4 1208
情书的邮戳
情书的邮戳 2020-12-29 13:26

I have a user profile section and Im trying to allow the user to edit their information. I am using vuex to store the user profile data and pulling it into the form. The e

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 13:55

    If you are looking for a non binding solution with vuex you can clone the object and use the local version for v-model than on submit commit it.

    in your created lifecycle function do this:

    created (){
        this.profile = Object.assign({}, this.$store.getters.getUserDetails);
    },
    

提交回复
热议问题