I have a form, where different validations can apply, depending on the parameter action, stored in VUEX store. I try this:
data: function() {
const validations = {
sendToProject: {
cardProject: {
required,
},
},
recallToBranch: {
fioReceiver: {
required,
}
}
}
return {
validations,
}
},
validations() {
return {
q: this.validations[this.action] // supposed to be this.validations['sendToProject']
}
},
computed: {
...mapGetters({
action: 'action',
}),
},
This actually works, but throws an error while bootstraping:
[Vue warn]: Error in render function: "TypeError: can't convert undefined to object"
and that error prevents non-Vue code (Bootstrap jQuery plugins initializations, etc) from execution.
How to fix?