1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-12-18 16:41:58 +00:00

Vue: lifecycle instance methods

This commit is contained in:
Julien Le Coupanec 2017-12-01 13:48:35 +01:00
parent b04042f56a
commit 4b0da67c73

View File

@ -519,7 +519,25 @@ vm.$emit(event, […args])
* ******************************************************************************************* */ * ******************************************************************************************* */
// If a Vue instance didnt receive the el option at instantiation, it will be in “unmounted”
// state, without an associated DOM element. vm.$mount() can be used to manually start the mounting
// of an unmounted Vue instance.
vm.$mount([elementOrSelector])
// Force the Vue instance to re-render. Note it does not affect all child components,
// only the instance itself and child components with inserted slot content.
vm.$forceUpdate()
// Defer the callback to be executed after the next DOM update cycle.
// Use it immediately after youve changed some data to wait for the DOM update.
// This is the same as the global Vue.nextTick, except that the callbacks this context is
// automatically bound to the instance calling this method.
vm.$nextTick([callback])
// Completely destroy a vm. Clean up its connections with other existing vms, unbind all its
// directives, turn off all event listeners.
// Triggers the beforeDestroy and destroyed hooks.
vm.$destroy()
/* ******************************************************************************************* /* *******************************************************************************************