79360649

Date: 2025-01-16 07:14:47
Score: 1.5
Natty:
Report link

I modified your code to this and this works.

<script setup>
    import CompA from './CompA.vue'
    import { ref, getCurrentInstance } from 'vue'

  const components = getCurrentInstance().appContext.components;
  // I do NOT want to use [CompA, CompA] because my inputs are strings
    const componentTreeName = [CompA, CompA]
</script>

<template>
  <h1>Demo</h1>
  <template v-for="compName in componentTreeName">
    <component :is="compName"></component>
  </template>
</template>

Refer to this link to see working example -> https://play.vuejs.org/#eNqVU8Fu2zAM/RVOl6RAZmPdTpkboEsLLDukxRZgh3kH1WYSZbZkSHSaIfD/7D/2Y6PkJHWbbGsvhsX3SD4+SltxWVXRukYxFInLrKoIHFJdjVKdkiorYwnGpqwuYW5NCb0oDief0utQtmBxPoAF0ri2FjVNtCOpM4Rml7hL0ACZYYy/nKmZ6eDiRF7/LJJVNTaacEPRA/m9rxDHMIHcwPRmBvdSE5CB2iF8C9oGreDvcIeZ9OHyJyhd1dxJWgRHVumF8+KfKJlZxKkskQU9rpTqJG7N8bbohLCsCknIJ4Bk+WZ0haVJYv4JgT0M69dzYy9S4TuEwkofd0tFyOK8AwRD5TppzEjiA9j2iDsaOgcxEIf9nFhpd1tHm2ndKN2C52e837ut2VlFBXtWqBxhiRZ7Z/8x43y03YYiTcOOnLfRYD/bUZocC56M8TD2Y+UzeVfgy5UrvcKM+lxVKn0lSaaCRR5N8xGLwsBXY4v81TOmaHcSJEGODkpJ6vcvi3xxvP07xtMRyHHfuVpEK2c0j7ENpLBJVaC9qUixrlQMISAekyzr/lOIka1xsI9nS8x+nIiv3MbHUnHLYtCu+XocMJKWn1ILX3+Z8tPpgGx+XTD7H+BndKaovcaW9qHWOcvu8ILaSVgGv6KZu94Qarcfygv1zCbwU8EL8tfxb6M/yH0bvQt5qW5E8wfK75B9

Reasons:
  • Blacklisted phrase (1): this link
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jesvin palatty