nativescript-community / ui-collectionview

Allows you to easily add a collection view (grid list view) to your projects. Supports vertical and horizontal modes, templating, and more.
Apache License 2.0
59 stars 18 forks source link

[Vue warn]: Failed to mount component: template or render function not defined #38

Closed Echoju closed 10 months ago

Echoju commented 2 years ago

Hi,

I am having an issue. I use CollectionView directly in a .vue file and I get this error : "[Vue warn]: Failed to mount component: template or render function not defined"

I followed every steps as described in the readme, but no results. I use the latest versions : "@nativescript-community/ui-collectionview": "^4.0.49" "@nativescript/core": "~8.2.0" "vue": "~2.6.12"

I use the following code :

<CollectionView :items="itemList" colWidth="50%" rowHeight="100"

...... import CollectionView from '@nativescript-community/ui-collectionview/vue';

components: { CollectionView }

Do I have to change something ? Has anyonelse this issue ?

Thanks.

farfromrefug commented 2 years ago

@Echoju you are installing it wrong https://github.com/nativescript-community/ui-collectionview#usage-in-vue=

Echoju commented 2 years ago

Thanks for your reply ! Could you explain a little more ? Is it the wrong npm install ? To be more clear I also have this in the app.ts => Vue.use(RadSideDrawer,CollectionView)

Thanks.

farfromrefug commented 2 years ago

@Echoju this is wrong:

import CollectionView from '@nativescript-community/ui-collectionview/vue';

components: {
CollectionView
}

please look at the linked documentation

Echoju commented 2 years ago

Thanks this was so simple ! I removed this => components: { CollectionView }

And adde a Vue.use

Thanks a lot !

Echoju commented 2 years ago

Hello, Sorry to bring back this issue. But I have still a problem with registering the component "CollectionView" I register my component as expected in my app.ts :

... import CollectionView from '@nativescript-community/ui-collectionview/vue' ... Vue.use(RadSideDrawer,CollectionView,BottomNavigationBar);

But I still have a message as following : "[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option."

In my component "home.vue" I have this code :

<CollectionView class="list_1" :items="my_list" colWidth="50%" rowHeight="180" width="95%" margin="0" marginLeft="0" paddingLeft="0" > </CollectionView>

Is this normal that the component CollectionView si not recognized ? Do I have to register the component in every "page" (vue.use) then why register it in the app.ts ?

Thanks a lot.

farfromrefug commented 2 years ago

@Echoju you can't register them like that. one at a time