当前位置: 首页 > news >正文

微信小程序 view 布局

这里写图片描述

刚看到这个效果的时候还真是和ReactNative的效果一致,属性也基本的一样. 
view这个组件就是一个视图组件使用起来非常简单。

主要属性:

flex-direction: 主要两个特性”row”横向排列”column”纵向排列

justify-content 主轴的对齐方式(如果flex-direction为row则主轴就是水平方向)

  • 可选属性 (‘flex-start’, ‘flex-end’, ‘center’, ‘space-between’, ‘space-around’)

align-items 侧轴对齐方式如果flex-direction为row则侧轴就是垂直方向)

  • 可选属性 (‘flex-start’, ‘flex-end’, ‘center’)

wxml

<view class="page">
    <view class="page__hd"> <text class="page__title">view</text> <text class="page__desc">弹性框模型分为弹性容器以及弹性项目。当组件的display为flex或inline-flex时,该组件则为弹性容器,弹性容器的子组件为弹性项目。</text> </view> <view class="page__bd"> <view class="section"> <view class="section__title">flex-direction: row</view> <view class="flex-wrp" style="flex-direction:row;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">flex-direction: column</view> <view class="flex-wrp" style="height: 300px;flex-direction:column;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: flex-start</view> <view class="flex-wrp" style="flex-direction:row;justify-content: flex-start;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: flex-end</view> <view class="flex-wrp" style="flex-direction:row;justify-content: flex-end;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: center</view> <view class="flex-wrp" style="flex-direction:row;justify-content: center;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class=

相关文章:

  • 首篇
  • 查看数据库字符集
  • vagrant 添加本地 box 安装 laravel homestead
  • eclipse(luna)创建web工程
  • Vim 折腾记
  • $.ajax()
  • 用Zookeeper实现分布式锁和选主
  • 最近5年183个Java面试问题列表及答案[最全]
  • cloudbase-init 自动扩盘的副作用 - 每天5分钟玩转 OpenStack(154)
  • Android笔记--TCP Scoket(字符串收发)
  • HTML5 自定义属性 dataset
  • 一步一步学Python(2) 连接多台主机执行脚本
  • MySQL添加用户、删除用户与授权
  • C#中HttpWebRequest的用法详解
  • Curl命令使用解析大全
  • 深入了解以太坊
  • IE9 : DOM Exception: INVALID_CHARACTER_ERR (5)
  • emacs初体验
  • ES10 特性的完整指南
  • Gradle 5.0 正式版发布
  • Iterator 和 for...of 循环
  • Less 日常用法
  • miniui datagrid 的客户端分页解决方案 - CS结合
  • spring security oauth2 password授权模式
  • SpringBoot几种定时任务的实现方式
  • Vue官网教程学习过程中值得记录的一些事情
  • Zepto.js源码学习之二
  • 翻译--Thinking in React
  • 机器学习中为什么要做归一化normalization
  • 解析带emoji和链接的聊天系统消息
  • 开源SQL-on-Hadoop系统一览
  • 力扣(LeetCode)21
  • 前端
  • 前端临床手札——文件上传
  • 突破自己的技术思维
  • PostgreSQL 快速给指定表每个字段创建索引 - 1
  • 阿里云ACE认证学习知识点梳理
  • # 数据结构
  • (01)ORB-SLAM2源码无死角解析-(56) 闭环线程→计算Sim3:理论推导(1)求解s,t
  • (1)Android开发优化---------UI优化
  • (a /b)*c的值
  • (Demo分享)利用原生JavaScript-随机数-实现做一个烟花案例
  • (pojstep1.3.1)1017(构造法模拟)
  • (Pytorch框架)神经网络输出维度调试,做出我们自己的网络来!!(详细教程~)
  • (大众金融)SQL server面试题(1)-总销售量最少的3个型号的车及其总销售量
  • (翻译)Entity Framework技巧系列之七 - Tip 26 – 28
  • (六)软件测试分工
  • (五)c52学习之旅-静态数码管
  • (一)UDP基本编程步骤
  • .MSSQLSERVER 导入导出 命令集--堪称经典,值得借鉴!
  • .net 生成二级域名
  • [2021]Zookeeper getAcl命令未授权访问漏洞概述与解决
  • [8481302]博弈论 斯坦福game theory stanford week 1
  • [ai笔记3] ai春晚观后感-谈谈ai与艺术
  • [Angular] 笔记 21:@ViewChild