1…必须先修改后赋值(就是加一个中间变量接收原来的数据,然后修改这个数据,后赋值给vue的data数据)
2.除第一个元素外的元素
:not(:first-child)
3.多层for循环,要变量全部放外面,不然很难处理,使用uniapp es6 map循环可以减少代码
4.uniapp预览图片 视频,组件自带打破小程序https的限制,直接 http://xxx就可以访问
5.数组方便的遍历方式
xx.forEach((item, index, arr) => {
arr[index] = "http:"+item
console.log(item, index, arr);//arr代表这个数组
})
- !!! 如果每个功能数据要分开,如果有交叉的地方,全部清空
谨慎用$set,多写几个函数和数据不吃亏
7.微信小程序 //xxx.com/xxx.png可解决 https访问http资源的问题,但是在普通html不生效
uni.createSelectorQuery().select('.comment-content').boundingClientRect(data=>{//目标位置的节点:类或者id
uni.createSelectorQuery().select(".content").boundingClientRect(res=>{//最外层盒子的节点:类或者id
uni.pageScrollTo({
duration: 100,//过渡时间
scrollTop:data.top - res.top ,//到达距离顶部的top值
})
}).exec()
}).exec();
9.微信小程序长按添加微信好友(或者:show-menu-by-longpress="true"加到preview也可以)
<image :show-menu-by-longpress="true" style=" margin-bottom: 100rpx;" src="/static/wx.png" mode="widthFix" ></image>