Skip to content

Commit

Permalink
feat: added vc-config-provider component
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyaoji committed Oct 10, 2021
1 parent 1ab1fb8 commit 84168f9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/components/config-provider/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { SFCWithInstall } from '@vue-cesium/utils/types'
import { App } from 'vue'
import ConfigProvider from './src'

ConfigProvider.install = (app: App): void => {
app.component(ConfigProvider.name, ConfigProvider)
}

const _ConfigProvider = ConfigProvider as SFCWithInstall<typeof ConfigProvider>

export default _ConfigProvider
export const VcConfigProvider = _ConfigProvider
17 changes: 17 additions & 0 deletions packages/components/config-provider/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineComponent } from 'vue'

import { useLocaleProps, useLocale } from '@vue-cesium/composables/use-locale'

export default defineComponent({
name: 'VcConfigProvider',
props: {
...useLocaleProps
// Add more configs
},

setup(_, { slots }) {
useLocale()

return () => slots.default?.()
}
})
8 changes: 7 additions & 1 deletion packages/vue-cesium/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ import {
VcFab,
VcFabAction
} from '@vue-cesium/components/ui'

// config
import { VcConfigProvider } from '@vue-cesium/components/config-provider'

import { SFCWithInstall } from '@vue-cesium/utils/types'

export default [
Expand Down Expand Up @@ -307,5 +311,7 @@ export default [
VcSpinnerTail,
VcSpinner,
VcFab,
VcFabAction
VcFabAction,

VcConfigProvider
]

0 comments on commit 84168f9

Please sign in to comment.