Skip to content

Commit

Permalink
chore(deps): upgrade vue-global-config to v0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cloydlau committed Jan 15, 2023
1 parent f095931 commit 10812c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"dependencies": {
"lodash-es": "^4.17.21",
"vue-demi": "^0.13.11",
"vue-global-config": "^0.3.1"
"vue-global-config": "^0.4.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.34.1",
Expand Down
13 changes: 3 additions & 10 deletions src/install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useGlobalConfig } from 'vue-global-config'
import { resolveConfig } from 'vue-global-config'
import type { Plugin, install } from 'vue-demi'
import Component from './Component'
import type { Mode } from './Component'
Expand All @@ -25,22 +25,15 @@ const withInstall = <T, E extends Record<string, any>>(

const globalProps: Record<string, any> = {}
const globalAttrs: Record<string, any> = {}
const globalListeners: Record<string, any> = {}
const globalHooks: Record<string, any> = {}

const ComponentWithInstall = withInstall(Component)

ComponentWithInstall.install = (app: any, options = {}) => {
const { props, attrs, listeners, hooks } = useGlobalConfig(options, Component.props)
const { props, attrs } = resolveConfig(options, Component.props)
Object.assign(globalProps, props)
Object.assign(globalAttrs, attrs)
Object.assign(globalListeners, listeners)
Object.assign(globalHooks, hooks)
app.component(ComponentWithInstall.name, ComponentWithInstall)
}

export { globalProps, globalAttrs, Mode }
export default ComponentWithInstall
export {
globalProps, globalAttrs, globalListeners, globalHooks,
Mode,
}

0 comments on commit 10812c5

Please sign in to comment.