transform-center
#
插件名- name: transform-center- aliases: center
#
安装- npm
- Yarn
npm install @jswork/styled-plugin-transform-center
yarn add @jswork/styled-plugin-transform-center
#
参数名称 | 类型 | description |
---|---|---|
value | string | 居中方式; x/y/xy; 默认为 'xy' |
绝对居中的一种实现方式。
#
原理- 父级 position: relative;
- 当前元素 top:50%; transform:translateY(-50%);
#
用法<View debug wh={200} auto relative> <View bg="#f60" c="#fff" f="38" wh={100} lh={100} circle plugin="center:xy" tc> 道 </View></View>
#
演示Live Editor
Result
SyntaxError: Unexpected token (1:8) 1 : return () ^