Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Vue blank page after separating list item component

I have the following code:

ReceiptList.vue

<template>
Hello
<div class="list-container">  
        <ul>
            <ReceiptListItem/>
        </ul>
</div>
</template>

<script setup>

import { ReceiptListItem } from '@/components/ReceiptListItem.vue' 

</script>

ReceiptListItem.vue

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<template> 
<li>
    <div class="two-rows">
        <div class="line-spread">
            <span class="id">1212121</span>
        </div>
        <div class="line-spread">
            <span class="">1</span>
        </div>
    </div>
</li>
</template>
    
<script setup>
</script>

As soon as I comment out ReceiptListItem from template and script in ReceiptList.vue it works fine and shows Hello. Howewer with presentReceiptListItem the page becomes blank.
What could be the reason of this behaviour?

>Solution :

It’s not a named import, so you have to import the component without the curly braces:

import ReceiptListItem from '@/components/ReceiptListItem.vue' 

instead of

import {ReceiptListItem} from '@/components/ReceiptListItem.vue' 

Rest seems to work when I put it into a playground

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading