9 Star 0 Fork 0

uiox_admin / wsy_uniapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
WQ 提交于 2022-09-11 10:31 . 0911 已认证不出现实名栏
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
import axios from './utils/request/request.js'
/**
* 给Vue函数添加一个原型属性$axios 指向Axios
* 这样做的好处是在vue实例或组件中不用再去重复引用Axios 直接用this.$axios就能执行axios 方法了
* 在.vue中使用,this.$axios.get
* @param {Object} config
*/
Vue.prototype.$axios = axios
// axios.defaults.adapter = function(config) {
// return new Promise((resolve, reject) => {
// console.log(config)
// var settle = require('axios/lib/core/settle');
// var 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);
// }
// })
// })
// }
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
uni.$showMsg = function(title = '数据请求失败',duration = 1500){
uni.showToast({
title,
duration,
icon:'error'
})
}
1
https://gitee.com/uiox/wsy_uniapp.git
git@gitee.com:uiox/wsy_uniapp.git
uiox
wsy_uniapp
wsy_uniapp
master

搜索帮助