Appearance
插件
uniui
uView
js
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
scss
@import '@/uni_modules/uview-ui/theme.scss';
vue
<style lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
</style>
json
// uni_modules 已经不需要再配置 easycom 了
{
"easycom": {
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
}
}
luch
js
import http from '@/api/http'
Vue.prototype.$http = http
js
import Request from '@/uni_modules/uview-ui/libs/luch-request'
// 创建实例
const http = new Request({
baseURL: '',
dataType: 'json'
})
export default http
js
// 修改配置
http.setConfig((config) => {
config.baseURL = ''
config.dataType = 'json'
return config
})
js
// 请求拦截器
http.interceptors.request.use(
(req) => {
req.header.token = token
return req
},
(err) => {
return Promise.reject(err)
}
)
js
// 响应拦截器
http.interceptors.response.use(
(res) => {
return res
},
(err) => {
return Promise.reject(err)
}
)