最近,接了一个酒业网站搭建的项目,下面是此项目的一个小小总结。
盒子模型 = 外边距(margin)+ border(边框) + 内边距(padding)+ content(内容)
① 没有border-box属性,子元素会加上padding和border的值,超过给定的宽高
① 用vm.$nextTick 替换掉 mounted
mounted () { this.$nextTick(() => { this._initScroll(), this._calculateHeight(); }); },
② 异步调用的话可以使用Promise(还没有尝试,先给自己埋个坑)
this.city = (await this.reverseCode({key:superkey,value:supervalue})).returnList.city; this.$apply(); // 检查异步更改参数值 reverseCode(point){ return new promise((resolve,project)=>{ wepy.request({ url: 'http://index', header: { 'content-type': 'application/json' }, success:function(res){ reslove(res); } }) }); } async getSwiper(){ this.swiperArr = (await wepy.request({url:"http://index"})).data; // await必须放在async中 }