diff --git a/preview/App.vue b/preview/App.vue index 5ac3458..d39e012 100644 --- a/preview/App.vue +++ b/preview/App.vue @@ -1,13 +1,17 @@ \ No newline at end of file diff --git a/src/components/button/index.ts b/src/components/button/index.ts index f176da4..f487870 100644 --- a/src/components/button/index.ts +++ b/src/components/button/index.ts @@ -1,3 +1 @@ -import NiButton from './Button.vue' -export { NiButton } -export default NiButton \ No newline at end of file +export {default as NiButton} from './Button.vue' diff --git a/src/components/config/ConfigProvider.vue b/src/components/config/ConfigProvider.vue index 55d381c..875e008 100644 --- a/src/components/config/ConfigProvider.vue +++ b/src/components/config/ConfigProvider.vue @@ -1,18 +1,13 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/src/components/config/defaultConfig.ts b/src/components/config/defaultConfig.ts index ed70bfa..16fb7c4 100644 --- a/src/components/config/defaultConfig.ts +++ b/src/components/config/defaultConfig.ts @@ -1,17 +1,17 @@ import { reactive } from "vue" -import { NiConfig } from "./types" +import type { NiConfig } from "./types" const defaultConfig = reactive({ logoName: ['星', '撰'], + messageOnMounted: false, size: 'default', zIndex: 2000, namespace: 'ni', }) -export default defaultConfig - function setNiConfig(config: Partial) { Object.assign(defaultConfig, config) } export { setNiConfig } +export default defaultConfig diff --git a/src/components/config/index.ts b/src/components/config/index.ts index ea3d110..1f20577 100644 --- a/src/components/config/index.ts +++ b/src/components/config/index.ts @@ -1,5 +1,3 @@ -import NiConfigProvider from './ConfigProvider.vue' -export * from './types' -export default NiConfigProvider -export { useNiConfig } from './useConfig' +export { default as NiConfigProvider } from './ConfigProvider.vue' +export { useNiConfig } from './useConfig' export { setNiConfig } from './defaultConfig' diff --git a/src/components/config/types.ts b/src/components/config/types.ts index 1acd67c..4870fba 100644 --- a/src/components/config/types.ts +++ b/src/components/config/types.ts @@ -1,5 +1,8 @@ export interface NiConfig { + // 配置logo logoName?: [string, string] + // 消息挂载 + messageOnMounted?: boolean name?: string size?: 'small' | 'default' | 'large' zIndex?: number diff --git a/src/components/config/useConfig.ts b/src/components/config/useConfig.ts index 30cdf71..9f92a78 100644 --- a/src/components/config/useConfig.ts +++ b/src/components/config/useConfig.ts @@ -3,7 +3,7 @@ import type { NiConfig } from './types' export function useNiConfig() { const config = inject>('ni-config') - + if (!config) { throw new Error('useConfig must be used within NiConfigProvider') } diff --git a/src/components/index.ts b/src/components/index.ts index 9bc4c32..a715597 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,19 +1,4 @@ -import NiButton from './button' -import NiLogo from './logo' -import NiConfigProvider, { useNiConfig } from './config' -import { setNiConfig } from './config/defaultConfig' -export { - NiButton, - NiLogo, - NiConfigProvider, - useNiConfig, - setNiConfig, -} - -export default { - NiButton, - NiLogo, - NiConfigProvider, - useNiConfig, - setNiConfig, -} \ No newline at end of file +export { NiButton } from './button' +export { NiLogo } from './logo' +export { NiConfigProvider, useNiConfig, setNiConfig } from './config' +export { useNiMessage } from './message' diff --git a/src/components/logo/Logo.vue b/src/components/logo/Logo.vue index 231420e..64e05b3 100644 --- a/src/components/logo/Logo.vue +++ b/src/components/logo/Logo.vue @@ -1,7 +1,7 @@