-
Notifications
You must be signed in to change notification settings - Fork 37
Export components individually #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@walfly is there any way to import it locally? |
Thank you, this is totally acceptable. But when I build it, I found that the mixed export (default and named) has a big problem.
And here has an explaining: rollup/rollup#1961 (comment) So I changed it to this: import VueZoomer from './vue-zoomer.vue'
import VueZoomerGallery from './vue-zoomer-gallery.vue'
export default {
install (Vue) {
Vue.component('VZoomer', VueZoomer)
Vue.component('VZoomerGallery', VueZoomerGallery)
},
// for locally register
Zoomer: VueZoomer,
Gallery: VueZoomerGallery,
} And use as: <!-- page1.vue -->
<script>
import VueZoomer from 'vue-zoomer'
export default {
components: {
VZoomer: VueZoomer.Zoomer,
VZoomerGallery: VueZoomer.Gallery,
},
}
</script> A little ugly, but without problem. Maybe a better way is: // lib.js
export { plugin, VueZoomer, VueZoomerGallery }
// globally usage
import { plugin } from 'vue-zoomer'
Vue.use(plugin)
// locally usage
import { VueZoomer, VueZoomerGallery } from 'vue-zoomer' But this is not backwards compatible. |
Published at |
Sounds great, Thanks! |
This plugin only registers 2 components, it doesn't provide any other additional features. It would be better to import these components where they are used instead of registering them globally using the
vue.use
syntax.The text was updated successfully, but these errors were encountered: