vue-fragment
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "vue-fragment", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "fragment component for vuejs", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-fragment.min.js", |
@@ -8,12 +8,10 @@ # vue-fragment | ||
For others, fragments are basically _root-less_ components. They come useful in many situations where you don't want to pollute the DOM, or you semantically return many elements at once. | ||
For others, fragments are basically _root-less_ components. They come useful in many situations where you don't want to pollute the DOM with a useless container, or you want to return many elements at once. | ||
### How | ||
It's impossible to use functional components or slots, since it's all about vDOM and there is a "you should return one root element" limitation… So, I'm using an (internal) directive which will dump all children of the target node into its parent at the time of insertion. Since directives can manipulate DOM, we can bypass that limitation. | ||
## how | ||
It's impossible to use functional components or slots, since Vue.js vDOM diffing has a "you should return one root element" limitation… Instead, I'm using an (internal) directive which will dump all the children of the fragment root node in its place. Since directives can manipulate DOM, we can act after rendering and bypass Vue limitation. | ||
TL;DR : I'm adding a `Fragment` component `<fragment />`. | ||
The component is called `Fragment` so you won't have to change much code when Vue3 native fragments arrive. That said, **I'm not a core developer of Vue.js, and I don't have any view of their implementation. I only know what fragments are and how they should work, and did my best to reproduce it ; so it _should_ be fine.** | ||
**The component is called `Fragment` after interesting discussions in issues/ about supporting a smooth transition to Vue3 native fragments.** | ||
### Use | ||
## use | ||
- download the package `npm i -s vue-fragment` | ||
@@ -20,0 +18,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10933
58