Skip to content
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

Lazy loaded Component shouldn't be prefixed with Lazy #83

Closed
dmx974 opened this issue Aug 4, 2020 · 6 comments
Closed

Lazy loaded Component shouldn't be prefixed with Lazy #83

dmx974 opened this issue Aug 4, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@dmx974
Copy link

dmx974 commented Aug 4, 2020

Dynamically (lazy loaded) components shouldn't be prefixed with Lazy. It adds confusion and can become dirty pretty quickly (especially I have a bunch of custom components in an other project with names already beginning with Lazy, like LazyLoad, LazySpin etc.)

So, instead of this:

<template>
  <LazyComponentFoo v-if="foo" />
  <button @click="foo=true">Load Foo</button>
</template>

you should use an explicit attribute (like defer, or lazy, IDN), maybe like this:

<template>
  <ComponentFoo defer v-if="foo" />
  <button @click="foo=true">Load Foo</button>
</template>
@judehunter
Copy link

yeah, I also felt it was a weird design choice.
adding an attribute/directive would be much better

@papertokyo
Copy link

Agree. An attribute/directive would fit in better not just with Vue's API but html itself. Like how you have attributes like async, defer, and preload on script and link tags.

@drewbaker
Copy link

Agree!

@atinux atinux added the enhancement New feature or request label Oct 23, 2020
@pi0
Copy link
Member

pi0 commented Apr 6, 2021

Supporting attribute requires having a loader that is not always working (global components and development mode). Still, you have a better prefix suggestion, which is more than welcome. We can easily add as an alias to plugin

@pi0 pi0 closed this as completed Apr 6, 2021
@drewbaker
Copy link

drewbaker commented Apr 6, 2021

Ok, if no directive, is it weird to do something like:

MyComponentName.lazy.vue

<my-component-name.lazy>

But the directive approach was better for sure as it allowed you to opt into lazy loading for that use of the component, rather than always lazy loading it always.

@pi0
Copy link
Member

pi0 commented Apr 6, 2021

Nice idea @drewbaker! I've created #180 to check different options we could have for naming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants