Need to assign a class to a value of inbox item in vue, when the value is string='null'. I almost got it to work, however, am unable to figure out one thing. Been following this examples https://vuejs.org/v2/guide/class-and-style.html, however, have some specifics. I need to be able to define class based on the value of computed property . . nested . . I have a form with a bunch of input fields (v-for), and I should check value for each and assign specific class if a condition is meet. I can do this only initially, but not when user starts to change input value.
this is for loop:
<div
class="form__field form__field--autocomplete"
v-for="input in info"
:key="input.PARAMETER_NAME"
v-if="input.PARAMETER_NAME != 'p_euser' && input.PARAMETER_NAME != 'p_dbuser_password'"
>
and this is one example of field . . there are others, based on the input.DATA_TYPE
<input
v-else-if="input.DATA_TYPE == 'smallint' || input.DATA_TYPE == 'int'"
v-model="recordComputed[input.PARAMETER_NAME]"
type="number"
class="form__field-input"
v-bind:class="['', { 'nullclass' : [recordComputed[input.PARAMETER_NAME=='null']] }]"
:disabled="input.i2_primary_key == '1' && method == 'edit'"
>
So . .recordComputed is main object (computed property . . ) defined as:
recordComputed: {
get () {
let record = this.record
this.info.forEach((input) => {
var parValue = this.selected[input.i2_header_db]
// if we do not have parValue and also it is an typeOf=='object', than we set it as null
if (!parValue && typeof (parValue) === 'object') {
parValue = 'null'
}
record[input.PARAMETER_NAME] = parValue
})
return record
},
So my question is . . . is it possible to "reacively" read value from computed property . . one of its keys value in order to change class only for this particular input field. If there are alternatives, would be open to suggestions.