1๐
โ
Is it possible to make compPropsIsBtnDigitizePolygonDisabled` lazy not
eager ?
Ideally, computed properties in Vue
are eagerly by default but to make it lazy
you can use data property
and watcher
together.
Example :
data() {
return {
isComputedPropertyInitialized: false
}
},
computed: {
compPropsIsBtnDigitizePolygonDisabled() {
if (!this.isComputedPropertyInitialized) {
return;
} else {
// You can add your logic here
}
}
},
watch: {
digitizePolygonInteractions(value) {
if (!this.isComputedPropertyInitialized && value) {
this.isComputedPropertyInitialized = true;
}
}
}
How to display value of
digitizePolygonInteractions
within the
thrown error ?
You can concatenate the error by using +
operator in your Error
function call.
throw new Error('WTF.digitizePolygonInteractions is: ' + digitizePolygonInteractions)
๐คDebug Diva
Source:stackexchange.com