1 Star 0 Fork 0

王三金/sailun-pad

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import uView from '@/uni_modules/uview-ui'
import store from './store/index.js'
import axios from 'axios'
import API from '@/api'
import plugins from './plugins' // plugins
// 解决uniapp 适配axios请求,避免报adapter is not a function错误
axios.defaults.adapter = config => {
return new Promise((resolve, reject) => {
let settle = require('axios/lib/core/settle');
let buildURL = require('axios/lib/helpers/buildURL');
uni.request({
method: config.method.toUpperCase(),
url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
header: config.headers,
data: config.data,
dataType: config.dataType,
responseType: config.responseType,
sslVerify: config.sslVerify,
complete: function complete(response) {
// console.log("执行完成:", response)
response = {
data: response.data,
status: response.statusCode,
errMsg: response.errMsg,
header: response.header,
config: config
};
settle(resolve, reject, response);
}
})
})
}
Vue.use(plugins)
Vue.use(uView)
Vue.config.productionTip = false
Vue.prototype.$API = API
App.mpType = 'app'
const app = new Vue({
...App,
store
})
app.$mount()
// #endif
API.GetEnumValue().then(res => {
store.state.enumValueList = res.data
})
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
import App from './App.vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/san_jin_wang_xin/sailun-pad.git
git@gitee.com:san_jin_wang_xin/sailun-pad.git
san_jin_wang_xin
sailun-pad
sailun-pad
master

搜索帮助