vuejs2 - 在 Quasar Framework 上创建 ajax 请求的正确方法

标签 vuejs2 quasar

正在添加<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/

相关文章:

vue.js - 如何在Vue中设置生产环境变量

javascript - Vuejs无法获取数组中的数据

graphql - Cypress graphql apollo 调用没有给出结果并自动重试

javascript - Quasar QTable 中的粘性标题

javascript - Quasar 弹出日历显示当前日期

javascript - $emit 没有从 axios 内部向父级发送消息

javascript - 如何在使用 Vue Router 重定向时传递参数

node.js - 将数据从 Node-Express 后端传递到 Vue 组件

vue.js - Ref 不适用于 Vue3 中的自定义组件

electron-builder - 如何在 M1 Mac 上构建适用于 ARM64 架构的 Quasar 应用程序