From 26ad5cba75a216d6adef8520aaa92ec55efcadcf Mon Sep 17 00:00:00 2001 From: cuixiaorui Date: Sun, 8 Nov 2020 18:16:10 +0800 Subject: [PATCH] feat: add setupGlobalOptions api for set global options --- src/entry.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/entry.js b/src/entry.js index 249191c14..16840ed52 100644 --- a/src/entry.js +++ b/src/entry.js @@ -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 @@ -271,7 +277,8 @@ export { usePrompt, useConfirm, useNotify, - install + install, + setupGlobalOptions } export default elementUI