Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Multiple true if conditions just runs the last true if

The issue I am facing here is if the user fetched user is administrator as we as accountant the only the last MyAccountantMenu show but MyAdministratorMenu doesn't show and if the user is User and administrator then only the MyAdministratorMenu shows. So in short only the last component with true condition shows.

<template>
  <div style='width: 100%;'>
    <MyUserMenu v-if='user.isUser && user_active' />
    <MyAdministratorMenu v-if='user.isAdministrator && user_active' />
    <MyAccountantMenu    v-if='user.isAccountant && user_active' />
  </div>
</template>

<script>
  import MyUserMenu from 'views/user-menu.vue';
  import MyAdministratorMenu from 'views/administrator-menu.vue';
  import MyAccountantMenu from 'views/accountant-menu.vue';

  export default {
    components: {
      MyUserMenu,
      MyAdministratorMenu,
      MyAccountantMenu
    },
    data: function() {
      return {
        user: {
          isUser: false,
          isAdministrator: false,
          isAccountant: false
        },
        user_active: false
      }
    },
    created: function() {
      this.fetchUser();
    },
    methods: {
      fetchUser() {
        var that = this
        this.$axios.get('/user.json')
        .then(response => {
          that.user.isUser = response.data.isUser;
          that.user.isAdministrator = response.data.isAdministrator;
          that.user.isAccountant = response.data.isAccountant;
          that.user_active = true;
        })
      }
    }
  };
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!