Skip to content

classState

Namespaces

Functions

classState()

classState(statePrefix): Is

创建类名状态函数,通过状态判定是否使用类名

Parameters

ParameterTypeDefault valueDescription
statePrefixstring''状态类名前缀

Returns

Is

状态函数

Example

ts
const is = classState()

is('is-state')
// => 'is-state'

is('is-state', false)
// => ''

is('state', true, 'is-')
// => 'is-state'

is(['is-state', ['is-state2', false], ['is-state3', true]])
// => ['is-state', '', 'is-state3']

is(['state', ['state2', false], ['state3', true, 'no-']], 'is-')
// => ['is-state', '', 'no-state3']