diff --git a/packages/install-site.js b/packages/install-site.js index 91c2b70..d3f65c1 100644 --- a/packages/install-site.js +++ b/packages/install-site.js @@ -1,19 +1,13 @@ import { inject } from 'vue' import { Fullscreen, Screen } from './plugins' -import { omit } from 'lodash-es' +import { forEach, omit } from 'lodash-es' const BaseKey = Symbol('Site') -const defaultPlugins = [ - { - name: 'fullscreen', - plugin: Fullscreen - }, - { - name: 'screen', - plugin: Screen - } -] +const defaultPlugins = { + fullscreen: Fullscreen, + screen: Screen +} function install (app, options) { const { config: pluginConfig } = options @@ -26,7 +20,7 @@ function install (app, options) { app.config.globalProperties.$site = $site app.provide(BaseKey, $site) - defaultPlugins.forEach(({ name, plugin }) => { + forEach(defaultPlugins, (plugin, name) => { const pluginOptions = { ...options, ...pluginConfig[name] } plugin.install(app, omit(pluginOptions, ['config']), $site) plugin.__installed = true diff --git a/packages/plugins/screen/index.js b/packages/plugins/screen/index.js index 8eafb8a..46bd24e 100644 --- a/packages/plugins/screen/index.js +++ b/packages/plugins/screen/index.js @@ -3,14 +3,13 @@ import { addClass, getWindowSize, removeClass } from '../../utils/dom' import { addEvt } from '../../utils/event' import { debounce, pick } from 'lodash-es' -const SIZE_LIST = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'] +const SIZE_LIST = ['sm', 'md', 'lg', 'xl', 'xxl'] export default createReactivePlugin({ width: 0, height: 0, name: 'xs', sizes: { - xs: 0, sm: 576, md: 768, lg: 992, @@ -65,10 +64,10 @@ export default createReactivePlugin({ this.gt.xl = width >= sizes.xxl this.xs = this.lt.sm - this.sm = this.gt.xs === false && this.lt.md === true - this.md = this.gt.sm === false && this.lt.lg === true - this.lg = this.gt.md === false && this.lt.xl === true - this.xl = this.gt.lg === false && this.lt.xxl === true + this.sm = this.gt.xs === true && this.lt.md === true + this.md = this.gt.sm === true && this.lt.lg === true + this.lg = this.gt.md === true && this.lt.xl === true + this.xl = this.gt.lg === true && this.lt.xxl === true this.xxl = this.gt.xl const name = (this.xs === true && 'xs')