首页 > 编程语言 >微信小程序踩坑

微信小程序踩坑

时间:2022-12-05 10:46:42浏览次数:41  
标签:自定义 微信 程序 focus 嵌套 text view 加载

  1.  text标签嵌套后添加事件无效,如下onTap是不触发的,解决方法:将最外层text改成view
    <text bindtap="onTap"><text>这里是一段文字</text></text>
  2. 在引入echarts图表的页面不能使用overflow:hidden,否则会滚动抖动,弹窗使用cover-view嵌套,cover-view里面嵌套slot,slot是不生效的,注意echarts图表的grid偏移量属性,否则会显示不全
  3. scroll-view下拉刷新,上拉加载更多,当使用下拉刷新时需要加载之后设置refer为false,否则加载效果不会消失
    <scroll-view
         refresher-enabled="{{ isRefresh }}"
         refresher-default-style="none"
         bindrefresherrefresh="refresh" 
         refresher-triggered="{{ refer }}"
         class="{{ customClass }}"
         scroll-y="true" 
         style="height: {{ height }}"
         bindscrolltolower="load">
    </scroll-view>
    
    // 传入自定义class,和data同级
     externalClasses: ['customClass']
    
    // 是否使用全局的样式
      options: {
        addGlobalClass: true
      },
  4.  wx.navigateTo 的events可做为登录后的回调,自定义处理登陆后的操作

  5. 短信验证码弹窗输入框高度获取,focus函数
    <input bindfocus="focus"/>
    focus (e) {
          this.setData({
            keyboardHeight: e.detail.height
          })
        },
  6.  将input输入框的enter键修改为搜索键,直接执行搜索操作

    <input type="text" confirm-type="search" bindconfirm="keyboardConfirm"/>

     

标签:自定义,微信,程序,focus,嵌套,text,view,加载
From: https://www.cnblogs.com/yseraaa/p/16951678.html

相关文章