-1
I am creating a Vuejs Component that I want to send a property to Component to display or hide an attribute inside the tag using ternary operator.
Double Quotes do not work inside the tag.
The result would be these two possibilities:
if Multiple is true
<div>
<select name="select" multiple>
</select>
</div>
if Multiple is false
<div>
<select name="select">
</select>
</div>
State of the current component
<template>
<div>
<select name="select" {{multiple ? 'multiple' : ''}}">
</select>
</div>
</template>
<script>
export default {
props: {
multiple: {
type: Boolean,
default: true
},
}
}
</script>
<style>
</style>
Example of a call to Component
<component-select :multiple="false"></component-select>
wasn’t exactly how you presented it, but I got the idea.
– Felipemeida