vue axios安装使用

main.js:
import axios from 'axios' //npm install axios -S
import VueAxios from "vue-axios" //npm install axios vue-axios --save
Vue.use(VueAxios,axios)

命令:
npm install axios -S
npm install axios vue-axios --save

函数内使用:
如:

        this.axios  //这里要加this
        .get(
          "https://www.fastmock.site/mock/820259754c7de3b262ea7aa67d2f663a/manage/product2",
          {
            params: {
              name: this.screenKey.name,
              region: this.screenKey.region,
              keyword: this.screenKey.keyword,
              barcode: this.screenKey.barcode,
              classify: this.screenKey.classify,
              allType: this.screenKey.allType,
              allSellType: this.screenKey.allSellType,
            },
          }
        )
        .then((ret) => {
          console.log(ret)
          this.productsData = ret.data.data;//这里注意有几个data
        })
        .catch(function (ret) {
          console.log("error");
          console.log(ret.data);
        })
全部评论

相关推荐

09-17 17:09
门头沟学院 Java
雨忄:有人给出过解法,拖晚点去,然后到时候再找其他理由商量,既增加他们的筛人成本,不一定会给你收回offer ,也能占位避免工贼
秋招的嫡长offer
点赞 评论 收藏
分享
面试拷打成m:我感觉他说的挺对的,感觉我找不到工作也要去送外卖了,至少饿不死
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务