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

180
Views
Vue 3 dynamic component inside setup template

I have following problem.

<script setup lang="ts">
import { RouterView } from "vue-router";
import defaultLayout from "@/layouts/default.vue";
import { useDefaultStore } from "@/stores/default";
let { getLayout } = useDefaultStore();
</script>

<template>
  <component :is="getLayout">
    <RouterView />
  </component>
</template>

I use Pinia as the store. I checked getLayout its getting defaultLayout

I know in Vue.js 2 you had to register it:

export default {
   components: {
      defaultLayout
   }
}

How do i do it now?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can't descructure the store like that, you have to use Pinias storeToRefs() (https://pinia.vuejs.org/core-concepts/#using-the-store). Maybe it has something to do with that, I can't tell without the code of the store.

I'd recommend using this plugin https://github.com/JohnCampionJr/vite-plugin-vue-layouts if you're using Vite and need layouts.

about 4 years ago · Juan Pablo Isaza Report
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!