UNPKG

y-design-ssr

Version:

SSR component library of YUI with Vue3

21 lines (20 loc) 871 B
/** * bem helper * --不传参默认返回block-- * b() => 'button' * --只第一个参数传string即为element-- * b('text') => 'button__text' * --只第一个参数传对象或数组即为block+modifiers-- * b({ disabled }) => 'button button--disabled' * b(['disabled', 'primary']) => 'button button--disabled button--primary' * --传两参数即为element+modifiers-- * b('text', { disabled:false, loading:true }) => 'button__text button__text--loading' */ export type Incoming = string | { [key: string]: unknown; }; export type Incomings = Incoming | Incoming[]; export type BEM = ReturnType<typeof createBEM>; export type G_BEM = ReturnType<typeof createGlobalBem>; export declare const createBEM: (block: string) => (el?: Incomings, mods?: Incomings) => string; export declare const createGlobalBem: () => (el: string, mods?: Incomings) => string;