正在添加<script>
标签包含jquery,然后调用$.post
或$.get
里面.vue
是正确的方法吗?
最佳答案
官方文档中有一个与此相关的部分:
主要是推荐使用VueJs或Axios的Vue资源插件。
<小时/>Quasar recommends using Vue Resource plugin for VueJs or Axios. These package are not provided by default so you will have to npm install them and import them from src/main.js.
axios。 ( More info )
npm install axios --save
示例:
axios.get('https://someurl/api/?something=1').then(response => {
...
}).catch(e => {
...
})
<小时/>
Vue 资源 ( More info )
npm install vue-resource --save
示例:
{
this.$http.get('/someurl/api/?something=1')
.then(response => {
//... response.body;
}, response => {
...
});
}
关于vuejs2 - 在 Quasar Framework 上创建 ajax 请求的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43777956/