来试试:
<script src="https://cdn.uv.cc/vue/2.6.10/vue.min.js"></script> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width,initial-scale=1.0"/> <div id="app"> <nested-addin :elements="list"></nested-addin> </div> <script> Vue.component('nested-addin', { // 声明 props props: ['elements'], // prop 可以用在模板内 // 可以用 `this.msg` 设置 template: ` <div style="padding: 10px 50px;"> <li v-for="el in elements" :key="el.name"> <p>{{ el.name }}</p> <nested-addin :elements="el.elements" /> </li> </div> `, //'<span>{{ msg }}</span>' }) new Vue({ el: '#app', data: { list: [ { name: "name 1", elements: [ { name: "name 2", &nbs ... ...