import Vue from ‘vue’
import App from ‘./App’
// 导入网络请求的包
import {$http} from '@escook/request-miniprogram’
import savefile from ‘@/new_file.js’
let mixins ={
onLoad(){
console.log(‘我是mixins’)
}
}
uni.
m
i
x
=
m
i
x
i
n
s
/
/
全
局
挂
载
u
n
i
.
mix = mixins // 全局挂载 uni.
mix=mixins//全局挂载uni.http = $http
// 请求开始之前做一些事情
$http.beforeRequest = function (options) {
uni.showLoading({
title: ‘数据加载中…’,
})
}
// 请求完成之后做一些事情
$http.afterRequest = function () {
uni.hideLoading()
}
// 自动请求头
$http.baseUrl = ‘https://www.uinav.com’
Vue.config.productionTip = false
uni.$toast = function(title=‘数据加载失败’,duration=1500){
uni.showToast({
title,
duration,
icon:‘none’
})
}
App.mpType = ‘app’
const app = new Vue({
…App
})
app.$mount()