Skip to content

Instantly share code, notes, and snippets.

@suyanhanx
Created April 17, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suyanhanx/5d34900cc23f8711ff3eac5989accab7 to your computer and use it in GitHub Desktop.
Save suyanhanx/5d34900cc23f8711ff3eac5989accab7 to your computer and use it in GitHub Desktop.
重置 Vue 组件的数据
/**
* 重置 Vue 组件的数据
* @param {Vue} instance
*/
export function resetVueData(instance: Vue): void {
Object.assign(instance.$data, (instance.$option.data as any).call(instance))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment