Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

93
Vistas
VueJS show different auth-navigation for tenancy

I have a project using Laravel Tenancy in Backend. In front using Vue i have this code

<template>
  <div>
    <guest-navigation v-if="!$store.state.auth.token" />
  </div>
  <div id="demo">
    <div v-if="$store.state.auth.token" class="h-screen flex">
      <div class="flex-1 min-w-0 bg-gray-200">
        <div class="sticky top-2">
          <auth-navigation />
        </div>
        <div class="sticky top-2">
          <auth-navigation-tenant v-if="tenant"/>           
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import GuestNavigation from "./components/Navigations/GuestNavigation";
import AuthNavigation from "./components/Navigations/AuthNavigation";
import AuthNavigationTenant from "./components/Tenancy/Navigations/AuthNavigation.vue";
import { ref, watch } from "vue";

export default {
  components: { AuthNavigation, GuestNavigation, AuthNavigationTenant },
  
  setup() {
    const tenant = localStorage.getItem('tenancy');
    const newTheme = ref("");
    const Demo = {
      data() {
        return {
          show: true,
        };
      },
    };
    watch({
      theme(newTheme) {
        newTheme === "light"
          ? document.querySelector("html").classList.remove("dark")
          : document.querySelector("html").classList.add("dark");
      },
    });
    return { 
      newTheme, 
      Demo,
      tenant,
    };
  },
};
</script>

When i make a login need show an especific menu, in this case

<div class="sticky top-2">
  <auth-navigation-tenant v-if="tenant"/>           
</div>

when i make a login, i store the tenancy in a localstorage, I call it from my setup

const tenant = localStorage.getItem('tenancy');

Now if the localStorage.getItem('tenancy') exist i want show only the <auth-navigation-tenant v-if="tenant"/>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda