iview-admin中接口的调用


  代码如下。

<template>
  <div>
    <Button @click="test(1)" >测试</Button>
  </div>
</template>

<script>
import axios from "@/libs/api.request";
export default {
  data() {
    return {};
  },
  methods: {
    test(index) {
      const data ={
        pageNo: 1,
        search: ”123“
      }
      axios.request({
          url: "sys/getSuperUser",
          data,
          method: "post"
        }).then(function(res) {
          console.log(res);
        });
    }
  }
};
</script>

<style lang="css">
</style>
View Code

   只要将src\config\index.js文件中的baseUrl对象进行修改就能更改接口基础地址。

  baseUrl: {
    dev: 'https://www.easy-mock.com/mock/5add9213ce4d0e69998a6f51/iview-admin/',  // 开发环境
    pro: 'https://produce.com'                                                    //生产环境
  },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM