小程序语法

小程序的屏幕宽固定为 750rpx (即750个物理像素)

 

让小程序内容在同一行

<view class="line">
    <view wx:for="{{item}}" > 
        <button class="abc" style="width: 125rpx;" size="mini" type="primary" 
                bindtap="clickButton" data-item="{{item}}">{{item}}</button>
    </view>
</view>


/* 修改高度,边距。按钮宽度只能在 标签内修改 */
.abc {
    margin-top:0rpx;
    margin-bottom:1rpx;
    margin-right:1rpx;
    margin-left:2rpx;
    height: 125rpx;
}
.line{
    display:flex;
}

 

2. 带参数跳转到其它页面

<view >
   <view style="font-size:62rpx; align-content: center;">舒尔特训练</view>

<text user-select="true">
    世界公认的“最强专注力训练法”,每天玩上10分钟,坚持了一个月的时间,专注状态的确要比之前强了很多。
    舒尔特方格最开始是为了训练飞行员的专注力,由美国神经心理医生舒尔特发明。主要通过视觉、听觉、动觉注意力训练,和注意力的稳定性、转移、分配等特性进行训练。由于这种方法效果显著、玩法简单,逐渐广泛应用到普通人身上。
</text>
<button type="primary" style="margin-top: 80rpx;" bindtap="gotoPage" data-rows="3">3x3</button>
<button type="primary" style="margin-top: 20rpx;" bindtap="gotoPage" data-rows="4">4x4</button>
<button type="primary" style="margin-top: 20rpx;" bindtap="gotoPage" data-rows="5">5x5</button>

</view>


   gotoPage(event){
        let rows = event.target.dataset.rows
        wx.navigateTo({
          url: '/pages/index/index?rows=' + rows,
        })
    }

 

posted @ 2022-05-19 11:55  得好好活  阅读(74)  评论(0编辑  收藏  举报