• 13.爱芳地产项目小程序全栈项目经验之uniapp


    1…必须先修改后赋值(就是加一个中间变量接收原来的数据,然后修改这个数据,后赋值给vue的data数据)

    2.除第一个元素外的元素

    :not(:first-child)
    
    • 1

    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代表这个数组
    		    })
    
    • 1
    • 2
    • 3
    • 4
    1. !!! 如果每个功能数据要分开,如果有交叉的地方,全部清空
      谨慎用$set,多写几个函数和数据不吃亏

    7.微信小程序 //xxx.com/xxx.png可解决 https访问http资源的问题,但是在普通html不生效

    8.uniapp跳转到指定位置(类似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();
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    9.微信小程序长按添加微信好友(或者:show-menu-by-longpress="true"加到preview也可以)

       <image :show-menu-by-longpress="true" style=" margin-bottom: 100rpx;" src="/static/wx.png" mode="widthFix" >image>
    
    • 1
  • 相关阅读:
    STM32G474产生一个锯齿波
    linux下使用vscode对C++项目进行编译
    【SpringCloud学习05】Docker
    Vue.js 框架源码与进阶 - Virtual DOM 的实现原理
    Karpor - 让 AI 全面赋能 Kubernetes!
    盘点 GitHub 上的神级指南
    交换机和路由器基础
    Shellcode——绕过31
    Leetcode 895. 最大频率栈
    Android 使用ContentObserver监听SettingsProvider值的变化
  • 原文地址:https://blog.csdn.net/weixin_47039303/article/details/127852737