![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
马达加斯加的灯塔
永远炙热,永远热爱
展开
-
uni-app实现列表懒加载
html中<view v-for="(item,index) in resultList" :key="index" class="item"></view><uni-load-more :status="loadStatus"></uni-load-more>vue实例中export default { data() { return { resultList: [], loadStatus: 'nomore',原创 2021-02-03 10:06:52 · 3989 阅读 · 3 评论 -
JS监听页面滚动
mounted(){ document.addEventListener('scroll', this.scroll)},beforeDestroy(){ document.removeEventListener('scroll', this.scroll)},scroll(){ this.scrollTop = document.body.scrollTop || document.documentElement.scrollTop},uni-app中APP端不支持,可在页面生命周期中原创 2020-11-03 09:33:11 · 557 阅读 · 0 评论 -
JS中以变量方式访问对象属性
this.enterprise[val]如search(){ this.$api.enterpriseDetail(this.params).then(res=>{ this.enterprise = res.data const basicInfo = ["shareholders","branches","majorMember","stocksinfos","changerecords"] basicInfo.forEach((val,index,arr)=>{ i原创 2020-11-03 09:07:06 · 671 阅读 · 0 评论 -
JS设置Cookie
设置CookiesetCookie(c_name, c_pwd, exdays) { let exdate = new Date(); //获取时间 exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays); //保存的天数 //字符串拼接cookie window.document.cookie = "userName" + "=" + c_name + ";path=/;expires原创 2020-10-31 11:17:33 · 2111 阅读 · 0 评论 -
JS中for循环实现异步方法同步执行
添加async,await关键字即在方法名前加async关键字,在执行异步方法前加await关键字 async getAllHistory() { this.allHistory.pop() for (let i = 0; i < 4; i++) { let params = { pageSize: '', pageNum: '', type: i + 1 } awa原创 2020-07-22 09:47:46 · 7233 阅读 · 1 评论