1、创建全局文件 Global.vue
<script
>
const serverSrc
= '..';
export default {
serverSrc
}
</script
>
2、全局引入 main.js
import global_
from './Global'
Vue
.prototype
.GLOBAL = global_
;
3、页面方法使用
slectList() {
this.$http
.post(this.GLOBAL.serverSrc
+ '/api/login/login1', {}, {
headers
: {},
emulateJSON
: true
}).then((res
) => {
}).catch(err
=> {
})
},
转载请注明原文地址: https://mac.8miu.com/read-489995.html