Skip to content

Commit

Permalink
feat: add setupGlobalOptions api for set global options
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Nov 8, 2020
1 parent d8a1697 commit 26ad5cb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,22 @@ const components = [
]

const install = (app, opts = {}) => {
app.config.globalProperties.$ELEMENT = {
size: opts.size || '',
zIndex: opts.zIndex || 2000
}
app.use(setupGlobalOptions(opts))

components.forEach((component) => {
app.use(component)
})
}

const setupGlobalOptions = (opts = {}) => {
return (app) => {
app.config.globalProperties.$ELEMENT = {
size: opts.size || '',
zIndex: opts.zIndex || 2000
}
}
}

const elementUI = {
version,
install
Expand Down Expand Up @@ -271,7 +277,8 @@ export {
usePrompt,
useConfirm,
useNotify,
install
install,
setupGlobalOptions
}

export default elementUI

0 comments on commit 26ad5cb

Please sign in to comment.