Skip to content

How to programmatically register components in script setup? #6780

Discussion options

You must be logged in to vote

Solution:

<script setup>
import { computed } from "vue";
import icons from "./icon.js";
const props = defineProps({
  iconComponentName: {
    type: String,
    default: "Icon1",
  },
});

const actualComponentName = computed(() => {
  return icons[props.iconComponentName];
});
</script>

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@liulinboyi
Comment options

@itchwoot
Comment options

@liulinboyi
Comment options

@liulinboyi
Comment options

@itchwoot
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by itchwoot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants