O'Reilly logo
  • Primo Sabatini thinks this is interesting:

The complete code of what we have done in this section can be found in the JSFiddle at https://jsfiddle.net/chudaol/xkhum2ck/1/ .


Cover of Learning Vue.js 2


Fiddle uses VueJS version used is 1.0.24 and not version 2. The code does not work with version 2.1.8.
Change https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.24/vue.js to https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.js.

Solution: Inner template needs to be surrounded with a <div></div>
Running the code with version 2.1.8 produces:
[Vue warn]: Cannot use v-for on stateful component root element because it renders multiple elements:
<item-component v-for="item in items" :item="item"></item-component> vue.js:525:7
[Vue warn]: Multiple root nodes returned from render function. Render function should return a single root node.
(found in compon...