From b9851cf0e930d1b1ad3858aad8041d799835b08e Mon Sep 17 00:00:00 2001 From: chenhaodong Date: Wed, 5 Jun 2019 18:12:40 +0800 Subject: [PATCH] mew-menu --- src/components/mew-menu-group/index.js | 3 +++ src/components/mew-menu-item/index.js | 3 +++ src/components/mew-menu/index.js | 10 ++++++++++ src/components/mew-menu/menu-group.vue | 33 +++++++++++++++++++++++++++++++++ src/components/mew-menu/menu-item.vue | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/mew-menu/menu.vue | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/mew-menu/mixin.js | 19 +++++++++++++++++++ src/components/mew-menu/submenu.vue | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/mew-submenu/index.js | 3 +++ src/index.js | 4 ++++ 10 files changed, 501 insertions(+), 0 deletions(-) create mode 100644 src/components/mew-menu-group/index.js create mode 100644 src/components/mew-menu-item/index.js create mode 100644 src/components/mew-menu/index.js create mode 100644 src/components/mew-menu/menu-group.vue create mode 100644 src/components/mew-menu/menu-item.vue create mode 100644 src/components/mew-menu/menu.vue create mode 100644 src/components/mew-menu/mixin.js create mode 100644 src/components/mew-menu/submenu.vue create mode 100644 src/components/mew-submenu/index.js diff --git a/src/components/mew-menu-group/index.js b/src/components/mew-menu-group/index.js new file mode 100644 index 0000000..0a971b8 --- /dev/null +++ b/src/components/mew-menu-group/index.js @@ -0,0 +1,3 @@ +import MenuGroup from '../mew-menu/menu-group.vue'; + +export default MenuGroup; \ No newline at end of file diff --git a/src/components/mew-menu-item/index.js b/src/components/mew-menu-item/index.js new file mode 100644 index 0000000..daa650d --- /dev/null +++ b/src/components/mew-menu-item/index.js @@ -0,0 +1,3 @@ +import MenuItem from '../mew-menu/menu-item.vue'; + +export default MenuItem; \ No newline at end of file diff --git a/src/components/mew-menu/index.js b/src/components/mew-menu/index.js new file mode 100644 index 0000000..b5cd748 --- /dev/null +++ b/src/components/mew-menu/index.js @@ -0,0 +1,10 @@ +import Menu from './menu.vue'; +import MenuGroup from './menu-group.vue'; +import MenuItem from './menu-item.vue'; +import Submenu from './submenu.vue'; + +Menu.Group = MenuGroup; +Menu.Item = MenuItem; +Menu.Sub = Submenu; + +export default Menu; \ No newline at end of file diff --git a/src/components/mew-menu/menu-group.vue b/src/components/mew-menu/menu-group.vue new file mode 100644 index 0000000..5037006 --- /dev/null +++ b/src/components/mew-menu/menu-group.vue @@ -0,0 +1,33 @@ + + diff --git a/src/components/mew-menu/menu-item.vue b/src/components/mew-menu/menu-item.vue new file mode 100644 index 0000000..961be0a --- /dev/null +++ b/src/components/mew-menu/menu-item.vue @@ -0,0 +1,89 @@ + + diff --git a/src/components/mew-menu/menu.vue b/src/components/mew-menu/menu.vue new file mode 100644 index 0000000..392b57a --- /dev/null +++ b/src/components/mew-menu/menu.vue @@ -0,0 +1,156 @@ + + diff --git a/src/components/mew-menu/mixin.js b/src/components/mew-menu/mixin.js new file mode 100644 index 0000000..6c7be91 --- /dev/null +++ b/src/components/mew-menu/mixin.js @@ -0,0 +1,19 @@ +import { findComponentUpward, findComponentsUpward } from '../../utils/assist'; +export default { + data () { + return { + menu: findComponentUpward(this, 'Menu') + }; + }, + computed: { + hasParentSubmenu () { + return !!findComponentUpward(this, 'Submenu'); + }, + parentSubmenuNum () { + return findComponentsUpward(this, 'Submenu').length; + }, + mode () { + return this.menu.mode; + } + } +}; diff --git a/src/components/mew-menu/submenu.vue b/src/components/mew-menu/submenu.vue new file mode 100644 index 0000000..e4e5ae1 --- /dev/null +++ b/src/components/mew-menu/submenu.vue @@ -0,0 +1,181 @@ + + diff --git a/src/components/mew-submenu/index.js b/src/components/mew-submenu/index.js new file mode 100644 index 0000000..5642b56 --- /dev/null +++ b/src/components/mew-submenu/index.js @@ -0,0 +1,3 @@ +import Submenu from '../mew-menu/submenu.vue'; + +export default Submenu; \ No newline at end of file diff --git a/src/index.js b/src/index.js index b7706f1..3fbedef 100644 --- a/src/index.js +++ b/src/index.js @@ -36,6 +36,7 @@ import Menu from './components/menu'; import Message from './components/message'; import MewMap from './components/mew-map'; import MewMapSelector from './components/mew-map-selector'; +import MewMenu from './components/mew-menu'; import Modal from './components/modal'; import Notice from './components/notice'; import Page from './components/page'; @@ -113,6 +114,9 @@ const components = { Message, MewMap, MewMapSelector, + MewMenu, + MewMenuGroup: MewMenu.Group, + MewMenuItem: MewMenu.Item, Modal, Notice, Option: Option, -- libgit2 0.21.4