微信小程序 --- 常见问题

 

1. < text/> 组件内只支持 <text/> 嵌套。不支持嵌套image组件,不然图片显示不出来

 

2. setData()回调传递的问题

 

3. scroll-view 点击相应盒子,以动画的形式移动到索引的位置

添加属性 scroll-into-view=“{{ toIndex }}”

给每个盒子动态分配ID,索引的位置toIndex就是索引的id值。

添加动画:添加属性scroll-with-animation=“true”,盒子就变速移动到索引的位置

https://blog.csdn.net/zhaoyazhi2129/article/details/53787695

 

4. 阻止微信小程序按钮自动功能例如“客服”、"分享"点击之后的冒泡

if (e.target.id.indexOf('share-btn') > -1) return

 

5. 动态添加类

class = "gooddesc-special {{ gooddescShow ? 'bbe0' : 'gooddesc-special' }} "

 

6. 动态选择多个盒子中的一个

<view wx:for="{{ productFamily }}" 
      wx:key="index" 
      data-index="{{ index }}"
      class="family-size {{ clickId == index ? 'click-family-size' : 'noclick-family-size'}}" 
      catchtap="clickProductSize"> 
      {{ item }}
</view>

 

12. 动态选择多个盒子中的一个 再次点击 取消选择

let clickAgain = that.data.clickAgain

let index= e.currentTarget.dataset.index

if (clickAgain == index){

      if (that.data.clickId == -1){

         that.setData({

            clickId: index

          });

       }else{

       that.setData({

           clickId: -1

        });

    }

}else{

       that.setData({

             clickAgain: index,

            clickId: index

       });

}

 

13. 微信小程序模板的引用

模板文件:

<template name="msgItem">…………</template>


引用的方式:

<import src ="../template/template.wxml"/>

<template is="msgItem" data="{{...cancelbeans}}" />

@import '../template/template.wxss';

7.  小程序 js 库。国密算法 sm2、sm3 和 sm4 的实现  sm-crypto 

https://github.com/wechat-miniprogram/sm-crypto

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值