Skip to content

Commit

Permalink
feat: init useEllipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo-shen committed Jan 8, 2024
1 parent c2f5171 commit aeb59ac
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './useToast';
export * from './useEllipsis'
1 change: 1 addition & 0 deletions packages/core/useEllipsis/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# useEllipsis
Empty file.
24 changes: 24 additions & 0 deletions packages/core/useEllipsis/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
interface UseEllipsisOptions {
rows?: number // 同组件 prop default: 1
content: string // 同组件 prop
dots?: string // 同组件 prop default: '...'
position?: 'start' | 'middle' | 'end' // 同组件 prop default 'end'
}
interface UseEllipsisReturn {
content: string // 省略后的内容
state: 'expand' | 'collapse' // 当前状态
toggle: Function // 切换状态
}

// eslint-disable-next-line import/prefer-default-export
export const useEllipsis = (
_el: HTMLElement,
_options: UseEllipsisOptions
): UseEllipsisReturn => {
const toggle = () => {}
return {
content: '',
state: 'collapse',
toggle,
}
}
2 changes: 2 additions & 0 deletions packages/core/useToast/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# UseToast

''`ts
import { useToast } from '@noi/core'
const { open } = useToast()
Expand Down

0 comments on commit aeb59ac

Please sign in to comment.