Closed wbern closed 6 years ago
After a little more research, it seems this happens when I
Upon second render, the content will be double.
It might be happening because of this line.
if (vueVersion >= 2) {
var elementOriginalChildren = element.cloneNode(true).childNodes; <- contains the entire custom-element, not just the children.
Hi, due to implementation, non-wrapped content passed to slots (like "Hello World" in <mybd-message message="success">Hello world</mybd-message>
, is wrapped using <span>
.
Currently it works like that and have low priority in TODO list. But PR's are welcome! The line needed to be adjust is https://github.com/karol-f/vue-custom-element/blob/373d59fdf03cbfcf2b45f7a32fe31e9c2238919d/src/utils/slots.js#L74
Regards!
@karol-f This still happens even if I wrap with \
However, I'm starting to think that angularjs is using a cached element with the rendered content from last render.
@wbern Hi, as you can see in https://codesandbox.io/s/wmz0mxn9l - when you wrap slot content (in this case <div class="wrapper">
) you end up with no <span>
element but provided wrapper.
Regards.
Works
.vue file / custom element
This works.
Not working / double output:
.vue file / custom element
Output:
Workaround: use vue-slot ( named slots ).
Notes: