在原生JS中使用
如果你不使用 React 等 Web 框架,你也可以安装 @fower/core
,用最原始的 Api 使用 Fower。
- npm
- Yarn
$ npm install @fower/core @fower/preset-web
$ yarn add @fower/core @fower/preset-web
基本使用:
import { fower, css } from '@fower/core'import preset from '@fower/preset-web'
fower.setConfig(preset)
const className = css('p-20 mx-10 borderGray text4XL')
const $app = document.getElementById('root')
$app.className = className
你也可以增加额外的自定义样式:
import { css } from '@fower/core'
const className = css('p-20', 'mx-10', 'borderGray', 'text4XL', { display: 'inline-block', textShadow: '1px 1px 2px pink',})
const $app = document.getElementById('root')
$app.className = className