Answer the question
In order to leave comments, you need to log in
Why didn't the API connect to VUE js?
Tell me, I watched the video on the API in VUE js and completed the first step to connect.
https://www.youtube.com/watch?v=YZEm4dTnP80 (not advertising)
- installed the plugin as in the video
- added the code (maybe I entered it in the wrong place, in the wrong brackets?) The
error
code was:
import Vue from 'vue'
import './plugins/vuetify'
import App from './App.vue'
import router from './router'
import store from './store'
import Vuetify from 'vuetify/lib'
import 'vuetify/dist/vuetify.min.css'
Vue.use(Vuetify)
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
import Vue from 'vue'
import './plugins/vuetify'
import App from './App.vue'
import router from './router'
import store from './store'
import Vuetify from 'vuetify/lib'
import 'vuetify/dist/vuetify.min.css'
var VueResource = require('vue-resource')
Vue.use(Vuetify)
Vue.use(VueResource)
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App),
data: {
endpoint: 'https://jsonplaceholder.typicode.com/posts'
},
methods: {
gatAllPosts: function () {
this.$http.get(this.endpoint).then(function(response) {
console.log(response)
}, function (error) {
//ошибка
})
}
},
created: function() { this.get.AllPosts
}
})
.$mount('#app')
Answer the question
In order to leave comments, you need to log in
gatAllPosts: function () {
this.get.AllPosts
how to solve the problem?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question