亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - The dom generated by vue is a bit strange. It is nested when written and at the same level when generated.
PHPz
PHPz 2017-05-19 10:29:56
0
1
645

<body>
  <p id="app">
    <p class="con1" @click="click">
      vue
      <p class="con2"></p>
    </p>
  </p>
  <script>
    var vm = new Vue({
      el: '#app',
      mounted() {
        for (let i of this.$el.children) {
          console.log(i)
        }
      },
      methods: {
        click() {
          for (let i = 0; i < this.$el.children.length; i++) {
            console.log(this.$el.children[i])
          }
        }
      }
    })
  </script>
</body>

It is obviously nested, but after generation it is the same level

PHPz
PHPz

學(xué)習(xí)是最好的投資!

reply all(1)
Peter_Zhu

This is followed by the vue 沒關(guān)系,是因?yàn)闉g覽器渲染的時(shí)候不允許 <p> 標(biāo)簽包含 <p> 標(biāo)簽,所以你自己看下,實(shí)際渲染生成了三個(gè) <p> tag.

Throw it aside vue and write a separate one

<p>1
    <p>2</p>
3</p>

You will also find that it is rendered by the browser as

<p>1</p>
<p>2</p>
"3"
<p></p>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template