# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
- http模块使用雷神thor 在common/thor目录下(请参考index页面)
- 支持使用vuex(请参考index页面)
- 支持less(请查看assets/css/app.less与index.vue页面)
引用
import thor from '../../common/thor/thor'
以下方法config参照wx.request
get, delete等 请求
thor.get(url,config)
.then(res=>{
console.log('请求成功', res);
})
.catch(err=>{
console.log('请求失败',err);
})
post,put,patch等请求
thor.post(url,data,config)
.then(res=>{
console.log('请求成功', res);
})
.catch(err=>{
console.log('请求失败',err);
})
通用请求
thor.request({
url:'',//地址
method:'',//方法
data:''//参数
header:'' //有需要就填
})
.then(res=>{
console.log('请求成功', res);
})
.catch(err=>{
console.log('请求失败',err);
})
小程序天然进行适配,有两种方式
/** 375px = 750rpx = 屏幕宽 **/
/** 1、[css单位演示]-px (px以375px标准宽进行适配) **/
.section{
width: 375px;
}
/** 2、[css单位演示]-rpx (rpx以750rpx标准宽进行适配) **/
.section{
width: 750rpx;
}
与web中的vuex使用一致
@theme-color: #FFA735;
.text-label {
color: @theme-color
}
@bg-grey: #dddddd;
@light-bg-grey: @bg-grey + #111;
.bgColor {
background-color: @light-bg-grey;
}
1、需要公共样式文件 src/assets/css/widow.css (后面所有的通用组件的样式都会放这里) 2、需要 src/utils/helper.js 文件(封装的组件中会用到)
- toast 吐司轻提示
- calenderHotel 日期控件
- imagePicker 上传图片组件
- cityLocator 城市定位与选择