Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

扩展主题 ui 配置接口 #565

Closed
Justineo opened this issue Oct 11, 2019 · 2 comments
Closed

扩展主题 ui 配置接口 #565

Justineo opened this issue Oct 11, 2019 · 2 comments

Comments

@Justineo
Copy link
Member

Justineo commented Oct 11, 2019

目前 ui 配置除了主题包自带的以外,用户新增 ui prop 或者 ui value 都比较麻烦,需要考虑新增一些接口方便用户添加自己的配置。

考虑新增 managers/ui,提供如下接口:

// 为已有的 ui prop 新增 value
addPropValue: (component: string, prop: string, value: string) => void

// 设置 prop 的默认值
interface SetDefaultFunc {
  (component: string, prop: string, value: string): void
  (prop: string, value: string): void
}
setPropDefault: SetDefaultFunc

// 添加新的 ui prop
addProp: (component: string, prop: string, propDef: Object) => void

// 替换已有的 icon 配置
setIcon: (component: string, icon: string, name: string | Function) => void

// 替换已有的 part 配置
setPart: (component: string, part: string, ui: string | Function) => void

// 修改 ui data
setData: (component: string, ui: string, key: string, value: any) => void

使用时可能是:

import ui from 'veui/managers/ui'

ui.addPropValue('button', 'size', 'xxl')

ui.setPropDefault('button', 'size', 's')
ui.setPropDefault('size', 's')

ui.addProp('button', 'fancy', { boolean: true })

ui.setIcon('button', 'loading', 'spinner')

ui.setPart('dialog', 'ok', 'fancy')

ui.setData('progress', 'm', 'strokeWidth', 12)
@Justineo
Copy link
Member Author

See also: #378

@Justineo
Copy link
Member Author

Implemented in #1164.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant