diff --git a/packages/core/index.ts b/packages/core/index.ts index 44a723a..a649dbe 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -1 +1,2 @@ export * from './useToast'; +export * from './useEllipsis' diff --git a/packages/core/useEllipsis/index.md b/packages/core/useEllipsis/index.md new file mode 100644 index 0000000..c7f79d2 --- /dev/null +++ b/packages/core/useEllipsis/index.md @@ -0,0 +1 @@ +# useEllipsis diff --git a/packages/core/useEllipsis/index.test.ts b/packages/core/useEllipsis/index.test.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/core/useEllipsis/index.ts b/packages/core/useEllipsis/index.ts new file mode 100644 index 0000000..ecd8475 --- /dev/null +++ b/packages/core/useEllipsis/index.ts @@ -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, + } +} diff --git a/packages/core/useToast/index.md b/packages/core/useToast/index.md index 8f1594c..ab77f97 100644 --- a/packages/core/useToast/index.md +++ b/packages/core/useToast/index.md @@ -1,3 +1,5 @@ +# UseToast + ''`ts import { useToast } from '@noi/core' const { open } = useToast()