1 Star 0 Fork 0

Jack先生/pyg14

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
Jack先生 提交于 2021-08-08 14:59 . cart ok
import Vue from 'vue'
import App from './App'
// 导入仓库实例对象
import store from './store/store'
// 导入请求库
import { $http } from '@escook/request-miniprogram'
// 配置请求根路径
// #ifdef H5 || APP-PLUS
$http.baseUrl = '/api'
// #endif
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO
$http.baseUrl = 'https://www.uinav.com'
// #endif
// 配置请求之前做的事情(请求拦截器的味道)
$http.beforeRequest = function(){
uni.showLoading({
title: '数据加载中...',
})
}
// 配置请求之后做的事情(响应拦截器的味道)
$http.afterRequest = function () {
uni.hideLoading()
}
// uni 是uni-app项目的顶层对象,我们可以将一些全局要用的东西直接挂载到这个上面来
uni.$http = $http
// 封装一个提示框方法
uni.$showMsg = function(title='数据加载失败!',duration=1500){
uni.showToast({
title,
duration,
icon:'none'
})
}
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App,
store
})
app.$mount()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jack-code-space/pyg14.git
git@gitee.com:jack-code-space/pyg14.git
jack-code-space
pyg14
pyg14
master

搜索帮助