【问题标题】:Axios asynchrone ajax request Vuejs not waiting for server responseAxios asynchrone ajax 请求 Vuejs 不等待服务器响应
【发布时间】:2020-11-12 06:54:55
【问题描述】:

我尝试根据一些过滤器从服务器获取列表。但是 vuejs 没有等待服务器响应。

   <input type="text" name="oooo" @input="getUsers">

    ...

    methods: {
      getUsers: async function () {
        const response = await axios.post('/skills', { {"key": "toto"} } );
        this.list = response.data;
        console.log(response);
      }
    }
    ...

我在服务器日志中得到结果。但是 vuejs 正在返回空数组。 我的 ajax 请求有什么问题? 谢谢

【问题讨论】:

    标签: ajax vue.js asynchronous async-await axios


    【解决方案1】:

    您正在使用 axios.post,而不是 axios.get

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-12
      • 2014-12-18
      相关资源
      最近更新 更多