0👍
Check this example
https://jsbin.com/jeqekexiqa/edit?html,js,console,output
First I noticed you are using two versions of vue together, which is not good.I sticked in example with Vue 2.
Next, this.$resource
is a bit strange thing for me, so I’m not sure what is suposed to do.You can use Vue.http
globally, or this.$http
if you want to use it directly into Vue instance.
In my example I defined array, where we would store data.Then I write method that would trigger http request and get JSON data from server, and store that data in items array in our data model.
But…that’s not enough because our method is not triggered, so we call it immediately after Vue instance is created, by using created()
lifecycle hook.
Later in template, we just do simple iteration with v-for
to show that everything is working.