vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

Initialise component that does not have a template? #1311

Open iamvitali opened 7 years ago

iamvitali commented 7 years ago

Hi, Is there a way to initialise a component that has no template (but has props and everything)?

I'm using it mostly for API stuff, so have 2 template components that are using this API component and I would like to pass props to it and use the $emit & $on to get data when the API call launches/gets results.

LinusBorg commented 7 years ago

image

jkzing commented 7 years ago

Yes, just return null in render function could do the trick: https://jsfiddle.net/jingkaizhao/r7d058ve/.

Um...but isn't mixin more suitable for your case?