小程序UI与容器组件

本文主要探讨微信小程序中的UI组件,重点解析容器组件,包括view、scroll-view和swiper。通过深入讲解,帮助开发者理解这些组件的使用场景和功能特性。
摘要由CSDN通过智能技术生成
目录
    1.总结与概述
    2.容器组件
            2.1 组件容器(view)
            2.2  可滚动视图容器(scroll-view)
            2.3 滑块视图容器(swiper)
1.总结与概述

1.1 UI组件总结图


 1.2 概述
        小程序的UI组件也就是定义用户界面的一系列标签, 类似于html标签。一个完整用户响应过程:事件触发——>UI组件接收到事件——>触发js函数响应事件——>更新UI

 2.容器组件

2.1 容器组件(view)
    (1)总结


    (2)例子
        效果图

        page.wxml
   
   
   
  1. <view>
  2. <text class="row-view-title">水平布局:</text>
  3. <view class="flex-wrp-row">
  4. <view class="flex-item-red" hover="true" hover-class="hover-style"><text class="color-text">red</text></view>
  5. <view class="flex-item-green" hover="true" hover-class="hover-style"><text class="color-text">green</text></view>
  6. <view class="flex-item-blue" hover="true" hover-class="hover-style"><text class="color-text">blue</text></view>
  7. </view>
  8. </view>
  9. <view>
  10. <text class="column-view-title">垂直布局:</text>
  11. <view class="flex-wrp-column" >
  12. <view class="flex-item-red" hover="true" hover-class="hover-style"><text class="color-text" >red</text></view>
  13. <view class="flex-item-green" hover="true" hover-class="hover-style"><text class="color-text">green</text></view>
  14. <view class="flex-item-blue" hover="true" hover-class="hover-style"><text class="color-text">blue</text></view>
  15. </view>
  16. </view>

        page.wxss
   
   
   
  1. .flex-item-red{
  2. background-color: red;
  3. height: 200rpx;
  4. width: 200rpx;
  5. text-align: center;
  6. line-height: 200rpx;
  7. }
  8. .flex-item-green{
  9. background-color: green;
  10. height: 200rpx;
  11. width: 200rpx;
  12. text-align: center;
  13. line-height: 200rpx
  14. }
  15. .
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值