[Vuejs]-Why I cannot see json data in table?

1๐Ÿ‘

โœ…

you create your app in advance. also where is your #app container?

<div id="app">
  <!-- your table data -->
</div>

and for the js

new Vue({
  el: '#app',

  // data should return an object, not be an object
  data() {
    return {
      items: [] // default value, could also be null
    }
  },

  // called on initialization, read about lifecycle hooks
  mounted() {
    fetch('data/vue-data.json').then(response => { this.items = response.json() })
  },

  methods: {
    toggleChildren(item) {
      item.childrenVisible = !item.childrenVisible;
    },
  }
});
๐Ÿ‘คzangab

Leave a comment