VNode constraint problem of vue

1. In all component trees, if VNode is a component or a slot, that contains components, then VNode must be unique. So the following two examples are wrong. how to understand this

first error Chestnut:

<div id="app">
    <ele>
        <div>
            <Child></Child>
        </div>
    </ele>
<div>
Vue.component("Child", {
    render: function (createElement) {
        return createElement("p", "text");
    }
});
Vue.component("ele", {
    render: function (createElement) {
        var ChildNode = createElement(Child);
        return createElement("div", [
            this.$slots.default,
            this.$slots.default
        ])
    }
})

these two chestnuts say they expect to render two Child components, that is, two

text

nodes, but actually render only one, because VNode is constrained.

but I"ve tried to render two nodes, that is,

text

, and I don"t know what one of them says

.
Apr.19,2021

rendering is fine, but it destroys subsequent updates.

this is an example: both p can be updated on the first click, but only the contents of the second p will be updated after the second click.

var Child = {
  props: {
    text: {},
  },
  render: function(createElement) {
    return createElement('p', this.text);
  },
};

Vue.component('ele', {
  data() {
    return {
      text: 'test',
    };
  },
  render: function(createElement) {
    var ChildNode = createElement(Child, {
      props: { text: this.text },
      nativeOn: {
        click: () => {
          this.text = 'clicked ' + new Date();
        },
      },
    });
    return createElement('div', [ChildNode, ChildNode]);
  },
});

new Vue({
  el: '-sharpapp',

  template: `
    <div id='app'>
      <ele />
    </div>
  `,
});

this is because the current implementation of vue will associate vnode with its rendered dom element one-to-one. When you render twice with the same vnode, vnode will only be associated with the last rendered dom element, so only the last dom can be updated in the patch phase.

this is essentially a defect of vue. Github already has related issue requests for vue to support vnode reuse, because this way of use is intuitive on the one hand, and there are actual usage scenarios on the other.

-Update
v2.5.18 vue supports vnode reuse.


ask the same question, has the landlord found the answer? I also directly render two


the same question, has the landlord found the answer? I also render two

directly.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36f0b-2b89e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36f0b-2b89e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?