'vue v-bind:class return invalid value
I am writing an application at vue and I am getting incorrect behavior, in particular my line :class=require ? 'require' : '' returns the string 'require' even when the value of require is false, what is the problem?
<template>
<custom-label label="Название">
<input
class="text_input"
:class="require ? 'require' : ''"
:value="$attrs.value" @input="$emit('input', $event.target.value)"
placeholder="Матрица всея барановичского района"
/>
</custom-label>
</template>
<script>
export default {
name: "InputText",
components: {CustomLabel},
computed: mapState({ state: state => state }),
props: {
require: Boolean
}
};
</script>
Below are screenshots from devtools


Solution 1:[1]
Use :class="{ require }" instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sebastiencn |
