Using Vue.js and I am trying to add a conditional event handler to the keydown event on an <input>. I want to avoid adding the click handler at all if the condition is not met. I followed Evan You's suggestion: https://github.com/vuejs/vue/issues/7349#issuecomment-354937350
I'm getting an error saying Cannot read property '_wrapper' of null for the following:
<input v-on: {
keydown: fieldData.fixedLength ? inputEnforceMaxlength : null,
}>
I also tried passing an empty object but got a different error saying: handler.apply is not a function for the following:
<input v-on: {
keydown: fieldData.fixedLength ? inputEnforceMaxlength : {},
}>
Is this the proper way to add conditional event handlers or are there are other alternatives? Thanks!
fieldData.fixedLength-- is not metnullor{}as a function which is why you get the error.