Note: Using Vue.js and Vuetify.js for functionality and styling.
With :class and @click properties, I was able to change the button's background color to desired color, but it applies the change to all of them, and not just the one that I clicked on.
Question: How do I have a button toggled without having all of them toggled at once?
In my vue file:
<v-layout>
<v-flex md6>
<v-text-field>Welcome.</v-text-field>
</v-flex md6>
<v-flex id="icon-filter">
<span>Filter by:</span>
<v-btn class="filter-button" :class="{toggled: isToggled}" @click="isToggled = !isToggled"><v-icon>local_offer</v-icon></v-btn>
<v-btn class="filter-button" :class="{toggled: isToggled}" @click="isToggled = !isToggled"><v-icon>notifications</v-icon></v-btn>
</v-flex>
</v-layout>
In the script section of same vue file:
<script>
export default {
data: function() {
return {
companies,
msg: "indiv",
dashboards: ['profile', 'charts'],
isToggled: false
}
},
methods: {
}
}
</script>
I've read through this question, but I get a Vue warning, mentioning that I have isToggled method as already defined data property. Toggle Class for an item Vue.js
I also read through vue.js docs on data binding, but still need help on this. https://vuejs.org/v2/guide/class-and-style.html
Vuetify framework has toggled buttons components, but client wants a distinct style, so cannot use this. https://vuetifyjs.com/components/buttons
isToggledfor each button, likelocalOfferIsToggled. - ceejayoz