I have a Vue component and I want to update a data source in the Root. I am already doing this with props but I am having trouble adding a second source called titleActive to it, the value of titleActive does not update on the root.
Component JS
<template>
<div>
<label v-for="topic in topics" class="radio-inline radio-thumbnail">
<input type="radio" @click="selectedValue(topic)" name="topics_radio" :id="topic.id" :value="topic.name" :checked="value && topic.id == value.id">
<span class="white-color lg-text font-regular text-center text-capitalize">{{ topic.name }}</span>
</label>
<ul class="hidden">
<li>{{ value }}</li>
</ul>
</div>
</template>
<script>
export default {
props: ['value','titleActive'],
data () {
return {
topics: [],
titleActive: false
}
},
methods:{
selectedValue(topic){
this.$emit('input', topic);
this.titleActive = true;
}
},
mounted(){
axios.get('/vuetopics').then(response => this.topics = response.data);
}
}
</script>
Vue Instance
<script>
var App = new Vue({
el: '#app',
data: {
selectedTopic: null,
selectedKeywords: null,
selectedProfiles: null,
questionTitle: null,
titleActive: false
},
methods: {
titleBlur: function(){
// this.selectedTopic = null;
}
}
});
</script>
HTML
<div class="form-group" id="app">
<topic v-model="selectedTopic"></topic>
</div>
v-bind:class="{ 'highlight': !selectedTopic }"and then step 2 withv-bind:class="{ 'highlight': selectedTopic }"but then how do I remove the highlight class from step 2 when I go to step 3 without enabling it again for step 1?vbind:class="{ highlight: statment1 && statement2 }"By having more than one data source to compare I was able to work out which element should have the.highlightclass on it.