'How can I register a component in <script setup>?
How can I register a component in <script setup>
?
Solution 1:[1]
Updated answer:
During the alpha stages of <script setup>
's implementation, component registration was done by exporting the component definition.
With the current officially released version (3.2.x), importing the component definition as you've done correctly registers the component:
<script setup>
import HiButton from '@/components/hive/button/index.vue' ?
</script>
Old answer that worked for alpha version of <script setup>
in 30-SEP-2020:
According to the RFC, your <script setup>
block needs to export the component like this:
<script setup>
export { default as HiButton } from '@/components/hive/button/index.vue'
</script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |