小程序

xpage { 100%; height: 100%; } page > view { position: initial !important; } view, picker, textarea, button, navigator { word-break: break-word; background-position: 50% 50%; background-repeat: no-repeat; background-size: 100% 100%; background-origin: padding-box; background-clip: padding-box; line-height: 1; box-sizing: border-box; background-color: transparent; border: none; padding: 0; margin: 0; border-radius: 0; display: block; position: relative; } /* 禁止触摸互动事件 */ .noPointer { pointer-events: none; } /*禁用长触弹出的下载图片菜单*/ .noCallout { -webkit-touch-callout: none; } /*禁用长触选择文字等功能*/ .noSelect { -webkit-user-select: none; } button::after { display: none; } .button-hover { background: rgba(0,0,0,0); }

reset 样式

防止多次点击

 

1、在data中加

buttonClicked:false

2、进入方法后 设置 buttonClicked 为true

this.setData({buttonCliked:true});

3、页面绑定时候 

bindtap="{{!buttonClicked?‘handleClicked’:’’}}”

 

 

class 里 使用三元运算 设置样式

 

<image src="{{imageInfo1.star1}}” class="star star-1 {{userAssistCount>=1?'star-on':''}}" data-id=“1” bindtap="showStarPage" />

 

 

获取用户信息

新的接口wx.getUserProfile,只能使用catchtap或者bindtap进行调用(ps:可以再wx.showmodel中使用),并不能再onload、onshow等位置直接调用

 

常用组件分享 如序列帧等

https://blog.csdn.net/qq_39816586/article/details/116023338

 

 

订阅消息

wx.requestSubscribeMessage({

  tmplIds: [''],

  success (res) { }

})

 

async 函数

https://segmentfault.com/a/1190000011526612

https://www.ruanyifeng.com/blog/2015/05/async.html

 

 

hidden 

<view hidden="{{hidden}}">

  </view>

 

建议使用css hidden 控制 页面显示

wx:if   影响小程序性能 可能会导致闪退

 

.hidden { 

  visibility: hidden; 

  pointer-events: none;

}

 

class="page {{showRegister?'':'hidden'}}"

 

分享

 

onShareAppMessage() {

    return {

      title: '自定义转发标题',

      path: '/page/user?id=123',

      promise 

    }

  }

 

 

 

原文地址:https://www.cnblogs.com/echolife/p/15030033.html