I am seeking an explanation of why I need the main wrapping div in this template in Vue. Without it, if the main element is the div with v-for - then listing of items stops working.
<script type="text/x-template" id="devlistitem">
<div><div class="item" v-for="item in cd_items">
<div v-if="!item.u" class="heade">{{ item.p }}</div>
<div v-if="item.desc" class="desc">{{ item.desc }}</div>
</div></div>
</script>
<script>// component
Vue.component('devlistitems', {
props: ['dataitems']
, computed: { cd_items: function () {
var x = this.dataitems; return APP_DATA[x]; }
}
, template:'#devlistitem'}
);</script>
Data are defined right in source, no ajax, and in main app I simply use a component with a property telling which data to use:
<devlistitems dataitems="json_items" />
Meaning to use APP_DATA['json_items'] as source data. Everything works ok, but removing the outer div makes it stop working.