feat(TagsView): Add TagsView component

feat(ContextMenu): Add ContextMenu component

feat(store): Add tagsView store
This commit is contained in:
kailong321200875
2022-01-16 17:55:20 +08:00
parent 4612e5544b
commit 349ac9d398
20 changed files with 900 additions and 164 deletions

View File

@@ -38,3 +38,24 @@ export const underlineToHump = (str: string): string => {
export const setCssVar = (prop: string, val: any, dom = document.documentElement) => {
dom.style.setProperty(prop, val)
}
/**
* 查找数组对象的某个下标
* @param {Array} ary 查找的数组
* @param {Functon} fn 判断的方法
*/
// eslint-disable-next-line
export const findIndex = <T = Recordable>(ary: Array<T>, fn: Fn): number => {
if (ary.findIndex) {
return ary.findIndex(fn)
}
let index = -1
ary.some((item: T, i: number, ary: Array<T>) => {
const ret: T = fn(item, i, ary)
if (ret) {
index = i
return ret
}
})
return index
}