responsive-list
#
插件名responsive-list
#
安装- npm
- Yarn
npm install @jswork/styled-plugin-responsive-list
yarn add @jswork/styled-plugin-responsive-list
#
参数名称 | 类型 | description |
---|---|---|
gap | numeric | string |
value | numeric | 每个item的最小宽度 |
绝对居中的一种实现方式。
#
原理note
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
- 适用于兼容性要求不高的场景,如后台的list列表
#
用法仅 X 方向居中
<View plugin="responsive-list:x"> <div style={{width: 200, height: 400}}>我是要被居中的 element</div></View>
#
演示Live Editor
Result
SyntaxError: Unexpected token (1:8) 1 : return () ^