绍兴seo网站管理,建网站引流做淘宝,wordpress瀑布流代码,Wordpress外贸网站搭建公司目录
基本使用
#分栏间隔
#混合布局
#分栏偏移
#对齐方式
API
#Row Props
#Col Props
#Row Events
#Col Events UniApp的uView组件库是一个丰富的UI组件库#xff0c;提供了各种常用的UI组件和布局方法#xff0c;帮助开发者快速构建美观、灵活的界面。下面给你写一…
目录
基本使用
#分栏间隔
#混合布局
#分栏偏移
#对齐方式
API
#Row Props
#Col Props
#Row Events
#Col Events UniApp的uView组件库是一个丰富的UI组件库提供了各种常用的UI组件和布局方法帮助开发者快速构建美观、灵活的界面。下面给你写一篇关于uView组件库的布局方法的博客
基本使用
通过col组件的span设置需要分栏的比例
templateview classu-pageview classu-demo-blocktext classu-demo-block__title基础使用/textview classu-demo-block__contentu-row customStylemargin-bottom: 10pxu-col span6view classdemo-layout bg-purple-light/view/u-colu-col span6view classdemo-layout bg-purple/view/u-col/u-rowu-row customStylemargin-bottom: 10pxu-col span4view classdemo-layout bg-purple/view/u-colu-col span4view classdemo-layout bg-purple-light/view/u-colu-col span4view classdemo-layout bg-purple-dark/view/u-col/u-rowu-row justifyspace-betweenu-col span3view classdemo-layout bg-purple/view/u-colu-col span3view classdemo-layout bg-purple-light/view/u-colu-col span3view classdemo-layout bg-purple/view/u-colu-col span3view classdemo-layout bg-purple-light/view/u-col/u-row/view/view/view
/templatestyle langscss.wrap {padding: 12px;}.demo-layout {height: 25px;border-radius: 4px;}.bg-purple {background: #CED7E1;}.bg-purple-light {background: #e5e9f2;}.bg-purple-dark {background: #99a9bf;}
/style#分栏间隔
通过设置row组件的gutter参数来指定每一栏之间的间隔(最终表现为左边内边距各为gutter/2)默认间隔为0
view classu-demo-block__contentu-rowjustifyspace-betweengutter10u-col span3view classdemo-layout bg-purple/view/u-colu-col span3view classdemo-layout bg-purple-light/view/u-colu-col span3view classdemo-layout bg-purple/view/u-colu-col span3view classdemo-layout bg-purple-light/view/u-col/u-row
/viewstyle langscss.wrap {padding: 12px;}.demo-layout {height: 25px;border-radius: 4px;}.bg-purple {background: #CED7E1;}.bg-purple-light {background: #e5e9f2;}.bg-purple-dark {background: #99a9bf;}
/style#混合布局
通过指定col组件的span属性指定不同的值达到不同的比例
view classu-demo-block__contentu-rowjustifyspace-betweengutter10u-col span2view classdemo-layout bg-purple-light/view/u-colu-col span4view classdemo-layout bg-purple/view/u-colu-col span6view classdemo-layout bg-purple-dark/view/u-col/u-row
/viewstyle langscss.wrap {padding: 12px;}.demo-layout {height: 25px;border-radius: 4px;}.bg-purple {background: #CED7E1;}.bg-purple-light {background: #e5e9f2;}.bg-purple-dark {background: #99a9bf;}
/style#分栏偏移
通过指定col组件的offset属性可以指定分栏偏移的栏数。
view classu-demo-block__contentu-rowjustifyspace-betweencustomStylemargin-bottom: 10pxu-colspan3offset3view classdemo-layout bg-purple-light/view/u-colu-colspan3offset3view classdemo-layout bg-purple/view/u-col/u-rowu-rowu-col span3view classdemo-layout bg-purple-light/view/u-colu-colspan3offset3view classdemo-layout bg-purple/view/u-col/u-row
/view#对齐方式
通过row组件的justify来对分栏进行灵活的对齐 可选值为start(或flex-start)、end(或flex-end)、center、around(或space-around)、between(或space-between) 其最终的表现类似于css的justify-content属性。
注意由于持微信小程序编译后的特殊结构此方式不支持微信小程序。
view classu-demo-block__contentu-rowjustifyspace-betweencustomStylemargin-bottom: 10pxu-colspan3view classdemo-layout bg-purple-light/view/u-colu-colspan3view classdemo-layout bg-purple/view/u-col/u-rowu-rowu-col span3view classdemo-layout bg-purple-light/view/u-colu-colspan3view classdemo-layout bg-purple/view/u-col/u-row
/view
API
#Row Props
参数说明类型默认值可选值gutter栅格间隔左右各为此值的一半单位任意String | Number0-justify水平排列方式(微信小程序暂不支持)Stringstart(或flex-start)end(或flex-end) / center / around(或space-around) / between(或space-between)align垂直排列方式Stringcentertop / bottom
#Col Props
参数说明类型默认值可选值span栅格占据的列数总12等分String | Number01-12offset分栏左边偏移计算方式与span相同String | Number0-justify水平排列方式Stringstartstart(或flex-start)、end(或flex-end)、center、around(或space-around)、between(或space-between)align垂直对齐方式Stringstretchtop、center、bottom、stretchtextAlign文字水平对齐方式Stringleftcenter / right
#Row Events
事件名说明回调参数clickrow被点击-
#Col Events
事件名说明回调参数clickcol被点击会阻止事件冒泡到row-
总的来说uView组件库提供了丰富的布局方法和UI组件可以帮助UniApp开发者快速构建出美观、灵活的界面布局提升开发效率为用户提供更加舒适的交互体验。开发者可以根据项目需求选择合适的uView组件轻松实现各种复杂的布局效果。