Created
April 17, 2020 08:38
-
-
Save suyanhanx/5d34900cc23f8711ff3eac5989accab7 to your computer and use it in GitHub Desktop.
重置 Vue 组件的数据
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 重置 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