1,新建一个baseService.js
const url = 'http://www.baidu.com'
const baseService = {
MedicalInsert:url+'/api/v1/MedicalSupervise/Insert',//新增
MedicalDelete:url+'/api/v1/MedicalSupervise/Delete/',//刪除
MedicalUpdate:url+'/api/v1/MedicalSupervise/Update/',//修改
MedicalTable:url+'/api/v1/MedicalSupervise/Get',//列表
// getApi(type) {
// switch (type) {
// case 'MedicalInsert':
// return url + '/api/v1/MedicalSupervise/Insert';//医疗督察新增
// case 'MedicalDelete':
// return url + '/api/v1/MedicalSupervise/Delete/';//医疗督察刪除
// case 'MedicalUpdate':
// return url + '/api/v1/MedicalSupervise/Update/';//医疗督察修改
// case 'MedicalTable':
// return url + '/api/v1/MedicalSupervise/Get';//医疗督察查列表
// default:
// return 'http://192.192.192.196:8896';
// // return '/api';
// }
// },
}
export default baseService;
2,挂载到main.js
import baseService from './assets/utils/baseService'
Vue.prototype.$baseService = baseService;
3,在页面中使用
·```
//请求table数据
GetProjectList() {
debugger
var that = this
this.loading2 = true
this.$axios.get(this.$baseService.MedicalTable, {
// params: this.$qs.stringify(this.formselect)
params: {
DepartMentName: this.formselect.DepartMentName,
PageIndex: this.PageIndex,
Pagesize: this.Pagesize
}
})
.then(function (res) {
that.total = res.data.totalCount
that.tableData = res.data.data;
that.loading2 = false
// alert(this.loading)
})
.catch(function (error) {
that.loading2 = false
console.log(error);
});
},
网友评论