![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JS
阳复初五
写字楼里写字间,写字间里程序员,程序人员写程序,又拿程序换酒钱。
展开
-
封装Axios
class Request { constructor (options = {}) { // 请求的根路径 this.baseUrl = options.baseUrl || '' // 请求的 url 地址 this.url = options.url || '' // 请求方式 this.method = 'GET' // 请求的参数对象 this.data = null // header 请求头 this.head原创 2021-07-15 14:45:06 · 100 阅读 · 0 评论 -
JS小程序根据数组对象的某个属性的最大值提取出来对象
showLable() { let maxscore=0 let labelResults = [ { label: "Porn", score: 0 }, { label: "Terror", score: 0 }, { label: "Sexy", score: 99 }, { label: "Normal", score: 40 } ];labelResults.forEach(item => { // consol.原创 2021-06-19 16:24:00 · 523 阅读 · 0 评论 -
小程序for循环添加不同样式
添加自定义index 然后根据自定义的index去进行三目判断 <block a:for="{{icon}}"> <view class='{{index===0?"integral1":index===1?"integral2":index===2?"integral3":index===3?"integral4":index===4?"integral5":""}}'data-index='{{index}}' onTap="effect">原创 2021-06-08 14:35:19 · 290 阅读 · 0 评论 -
Unexpected token u in JSON at position解决方法
一般出现这个 Unexpected token u in JSON at position 0问题,是JSON.parse时候解析了undefined,此时我们找到JSON解析代码,去找为什么会出现undefined并且加上判断语句就行了 onLoad(query) { console.log(query) if(query.orderRow){ this.setData({ orderRowList:JSON.parse(query.orderRow原创 2021-05-26 11:01:26 · 33652 阅读 · 5 评论