Is there a proper way of resetting a component's initial data in vuejs?

后端 未结 5 1396
遥遥无期
遥遥无期 2020-11-29 18:07

I have a component with a specific set of starting data:

data: function (){
    return {
        modalBodyDisplay: \'getUserInput\', // possible values: \'ge         


        
5条回答
  •  悲&欢浪女
    2020-11-29 18:48

    Caution, Object.assign(this.$data, this.$options.data()) does not bind the context into data().

    So use this:

    Object.assign(this.$data, this.$options.data.apply(this))

    cc this answer was originally here

提交回复
热议问题