You can map remote data directly into your Vue.js templates using RxJS. This lesson uses axios (and the vue-axios library which exposes axios on components as this.$http
) and wraps the remote call inside of an Observable to provide the data into the template
Install:
npm i --save axios vue-axios
main.js:
import 'buefy/lib/buefy.css'import Vue from 'vue'import App from './App.vue'import Rx from 'rxjs'import VueRx from 'vue-rx'import Buefy from 'buefy'import Axios from 'axios';import VueAxios from 'vue-axios'Vue.use(VueRx, Rx)Vue.use(Buefy)Vue.use(VueAxios, Axios)Vue.config.productionTip = falsenew Vue({ render: h => h(App)}).$mount('#app')
app.vue:
{ {people$}}