uniapp 请求封装 luch-request

313 阅读1分钟
import Request from 'luch-request'
export const http = new Request({
	baseURL:'http://127.0.0.1:3100',
	timeout:30000,
});
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import {http} from 'config/index.js'

Vue.config.productionTip = false

App.mpType = 'app'

window.http = http

const app = new Vue({
    ...App
})
app.$mount()

// #endif
login() {
        http.post('/api/user/account/login', {
                "credential": "Robinson",
                "password": "12345678aA!"
        }).then(res => {
                console.log(res);
        }).catch(err => {
                console.log(err);
        })
}