js

作者: 赤焰军少帅林殊 | 来源:发表于2018-08-15 17:52 被阅读10次

多个参数

data-id="{{data[index].roomid}},{{data[index].stat}}

控制器传参

 wx.navigateTo({
        url: "/pages/Activity/activity?id="+_id
      })
      

web view

<web-view class="webitem" src="https://www.baidu.com"></web-view>
  <c-thumb-list
    articleData="{{gifData}}"
    viewType="new"
    flowStyle="{{flowStyle}}">
  </c-thumb-list>
模块之间传值

按钮
<button class='sharebtn' type="default" size="default"  bindtap="default" hover-class="other-button-hover"> 分享给朋友> </button>
image底部留边问题
 width: 100%;
 height: 240rpx;
 display:block;将image对象设置为块级元素
display:flx弹性布局 相对位置进行 flex-direction: row有联系
page{
  background:rgb(241, 241,241);
}
小程序控制器的背景颜色
button背景颜色设置 需要去掉type或者 css样式要这样shareview .sharebtn 用view承接
背景颜色透明  background-color: transparent;
横竖布局取决于这三个配合
position: absolute;
 flex-direction: row;
 display: flex;

微信小程序: swiper 的 swiper-item 下 scroll-view 无法滚动
假如display :flx弹性布局
小程序文本超出固定宽带
overflow:hidden; //超出一行文字自动隐藏

text-overflow:ellipsis;//文字隐藏后添加省略号

white-space:nowrap; //强制不换行

函数执行回调


![image.png](https://img.haomeiwen.com/i2587602/6ff771946691038e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

label字体垂直居中
 display:flex;
justify-content:center;
align-items:center;

或者直接  line-height: 具体高度rpx;
position: fixed;
bottom: 0;
固定屏幕位置悬浮
.modal-mask {
    width:100%;
    height:100%;
    display:flex;
    flex-direction:column;
    justify-content:center;
    overflow:hidden;
    position:fixed;
    bottom:0px;
    z-index:1001;
    text-align:center;
    background:rgba(0, 0, 0, 0.65);

}

.modal-wrap {   
    display: flex;
    width: 78%;
    min-height: 300rpx;
    position: relative;
    left: 11%;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border-radius: 10rpx;
    padding-bottom:150rpx;
    box-sizing:border-box;
    background-color: #fff;
}
弹唱固定css
 onShareAppMessage: function (res) {

    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '自定义转发标题',
      path: '/page/user?id=123'
    }
  }
自定义分享小程序内容
js字典为空的判断方法

var judgeObj = function(obj){
    if(JSON.stringify(obj) == "{}") return true;
    else return false;
}

微信小程序分享群回调详细信息
  onLoad: function (options) {
  

    wx.showShareMenu({
      withShareTicket: true
    })
}

onShareAppMessage: function (res) {

    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '淘气抽奖送娃娃',
      imageUrl:"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3701485667,96126389&fm=200&gp=0.jpg",
      success: function (res) {
      
        if(res.shareTickets){
            
           wx,wx.getShareInfo({
             shareTicket: res.shareTickets[0],
             success: function(data) {
               console.log("分享成功", data);
             },
             fail: function(res) {

             },
             complete: function(res) {

             },
           })

        }
      },
   
      fail: function (res) {
        console.log("转发失败");
      }
    }
  }

相关文章

网友评论

      本文标题:js

      本文链接:https://www.haomeiwen.com/subject/leykbftx.html