I am trying to use a click event on my tabs to set the value of a variable inside data()
I then use this variable in an if statement on my components to test the value and display the component if true. But this isn't working and I'm getting no errors. I assume that the value of the variable isn't being set when the click event on the tabs fires. Can I not achieve the functionality with this method?
<template>
<div id="settings_page" class="page_body">
<h1>Settings</h1>
<div id="user_info" v-if="user">
<div id="tabs">
<div v-on:click="selected_tab == 'account'">Account Details</div>
<div v-on:click="selected_tab == 'divisions'">Divisions</div>
<div v-on:click="selected_tab == 'users'">Users</div>
<div v-on:click="selected_tab == 'columns'">Columns</div>
</div>
<div class="content">
<div v-if="selected_tab == 'account'">
<h2>Profile</h2>
</div>
<div v-if="selected_tab == 'divisions'">
divisions
</div>
<div v-if="selected_tab == 'users'">
users
</div>
<div v-if="selected_tab == 'columns'">
columns
</div>
</div>
</div>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
export default {
data() {
return {
selected_tab: 'account'
}
},
computed:mapGetters(['user']),
methods: {
...mapActions(['getProfile'])
},
created() {
this.getProfile();
}
}
</script>