Skip to content

Instantly share code, notes, and snippets.

@anish2690
Created December 21, 2021 11:14
Show Gist options
  • Save anish2690/633f313cec401fb381e3c974101b46e0 to your computer and use it in GitHub Desktop.
Save anish2690/633f313cec401fb381e3c974101b46e0 to your computer and use it in GitHub Desktop.
Vue.prototype.$forceCompute= function(computedName, forceUpdate /* default: true */) {
if (this._computedWatchers[computedName]) {
this._computedWatchers[computedName].run();
if (forceUpdate || typeof forceUpdate == 'undefined') this.$forceUpdate()
}
}
this.$forceCompute('title')
this.$forceCompute('title', false) // No force update
// https://github.com/vuejs/vue/issues/214#issuecomment-692064376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment