0👍
Your main.js
and index.html
shouldn’t mix template in HTML and render function. So your main.js
should be:
```new Vue({
el: '#user',
components: { User },
data() {
return {
groups: []
}
},
...```
-
You shouldn’t directly reassign data value because Vue cannot detect property additions and rerender view. You should do it via
Vue.set
orthis.$set
like this:this.$set(this, 'groups', response.data)
You can read more about how vue reactive in https://v2.vuejs.org/v2/guide/reactivity.html and Vue.set API: https://v2.vuejs.org/v2/api/#Vue-set
- [Vuejs]-VUE and Pagination : pag.component loose values after pager is changed/clicked
- [Vuejs]-Too many requests when controlling spinner show/hide from axois interceptors
0👍
Seems like you are putting 2 Vue instances on the same template since in your main file you are defining the template as el: "#user"
which is already controlled by User.vue
.
In you index.html add a div with id="app"
and in main.js set el: "#app"
Source:stackexchange.com