- 选项一
- 选项二
- 选项三
- 选项四
+
+
+ 更多菜单
+
+
+ 黄金糕
+ 狮子头
+ 螺蛳粉
+ 双皮奶
+ 蚵仔煎
+
+
+
+ 更多菜单
+
+ 黄金糕
+ 狮子头
+ 螺蛳粉
+ 双皮奶
+ 蚵仔煎
+
-
- 选项一
- 选项二
- 选项三
- 选项四
-
```
:::
@@ -98,33 +113,51 @@
:::demo 在`trigger`属性设置为`click`即可。
```html
-
- hover 激活
-
- 选项一
- 选项二
- 选项三
- 选项四
-
-
-
- click 激活
-
- 选项一
- 选项二
- 选项三
- 选项四
-
-
+
+
+ hover 激活
+
+
+ 下拉菜单
+
+
+ 黄金糕
+ 狮子头
+ 螺蛳粉
+ 双皮奶
+ 蚵仔煎
+
+
+
+
+ click 激活
+
+
+ 下拉菜单
+
+
+ 黄金糕
+ 狮子头
+ 螺蛳粉
+ 双皮奶
+ 蚵仔煎
+
+
+
+
```
:::
+
### Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- |
-| text | 菜单按钮文本 | string | — | — |
| type | 菜单按钮类型,同 Button 组件 | string | — | — |
-| trigger | 触发下拉菜单的方式 | string | hover,click | hover |
-| icon-separate | 独立的下拉菜单按钮 | boolean | — | true |
-| size | 菜单按钮尺寸,同 Button 组件 | string | large, small, mini | — |
+| split-button | 带下拉框的按钮 | boolean | — | false |
| menu-align | 菜单水平对齐方向 | string | start, end | end |
+| trigger | 触发下拉的行为 | string | hover, click | hover |
+
+### Events
+| 事件名称 | 说明 | 回调参数 |
+|---------- |-------- |---------- |
+| click | `split-button` 为 true 时,点击左侧按钮的回调 | — |
diff --git a/packages/dropdown-menu/index.js b/packages/dropdown-menu/index.js
new file mode 100644
index 00000000..72ff1af8
--- /dev/null
+++ b/packages/dropdown-menu/index.js
@@ -0,0 +1,7 @@
+const ElDropdownMenu = require('../dropdown/src/dropdown-menu');
+
+ElDropdownMenu.install = function(Vue) {
+ Vue.component(ElDropdownMenu.name, ElDropdownMenu);
+};
+
+module.exports = ElDropdownMenu;
diff --git a/packages/dropdown/src/dropdown-menu.vue b/packages/dropdown/src/dropdown-menu.vue
index 5fe2a998..329ac8b1 100644
--- a/packages/dropdown/src/dropdown-menu.vue
+++ b/packages/dropdown/src/dropdown-menu.vue
@@ -1,5 +1,5 @@
-
@@ -7,6 +7,11 @@
import Popper from 'main/utils/popper';
export default {
+ name: 'ElDropdownMenu',
+
+ props: {
+ visible: Boolean
+ },
data() {
return {
popper: null
@@ -17,13 +22,6 @@
return this.$parent.menuAlign;
}
},
- methods: {
- updatePopper() {
- if (this.popper) {
- this.popper.update();
- }
- }
- },
mounted() {
document.body.appendChild(this.$el);
diff --git a/packages/dropdown/src/dropdown.vue b/packages/dropdown/src/dropdown.vue
index 75b7d428..3fd35f34 100644
--- a/packages/dropdown/src/dropdown.vue
+++ b/packages/dropdown/src/dropdown.vue
@@ -1,78 +1,24 @@
-
-
-
-
- {{text}}
-
-
-
-
-
-
- {{text}}
-
-
-
-
-
-
-
-
-
diff --git a/packages/theme-default/src/button.css b/packages/theme-default/src/button.css
index 91a1acd6..dd9b98c9 100644
--- a/packages/theme-default/src/button.css
+++ b/packages/theme-default/src/button.css
@@ -35,16 +35,7 @@
border: 0;
}
- & .el-icon-right {
- margin-left: 5px;
- }
- & .el-icon-left {
- margin-right: 5px;
- }
-
& [class*="el-icon-"] {
- /*line-height: 0.9;*/
-
& + span {
margin-left: 5px;
}
diff --git a/packages/theme-default/src/dropdown.css b/packages/theme-default/src/dropdown.css
index d4be874c..13d89bf7 100644
--- a/packages/theme-default/src/dropdown.css
+++ b/packages/theme-default/src/dropdown.css
@@ -53,8 +53,9 @@
}
}
@e icon {
- padding-left: 5px;
- transform: scale(.8, .8);
+ font-size: 12px;
+ vertical-align: middle;
+ margin: 0 3px;
}
@m text {
.el-button-text {
diff --git a/packages/theme-default/src/icon.css b/packages/theme-default/src/icon.css
index deeba92b..f24d22b4 100644
--- a/packages/theme-default/src/icon.css
+++ b/packages/theme-default/src/icon.css
@@ -69,6 +69,13 @@
animation: rotating 1s linear infinite;
}
+.el-icon-right {
+ margin-left: 5px;
+}
+.el-icon-left {
+ margin-right: 5px;
+}
+
@keyframes rotating {
0% {
transform: rotateZ(0deg);
diff --git a/src/index.js b/src/index.js
index 19488fd9..f828f6d5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,7 @@ import Pagination from '../packages/pagination/index.js';
import Dialog from '../packages/dialog/index.js';
import Autocomplete from '../packages/autocomplete/index.js';
import Dropdown from '../packages/dropdown/index.js';
+import DropdownMenu from '../packages/dropdown-menu/index.js';
import DropdownItem from '../packages/dropdown-item/index.js';
import Menu from '../packages/menu/index.js';
import Submenu from '../packages/submenu/index.js';
@@ -62,6 +63,7 @@ const install = function(Vue) {
Vue.component(Dialog.name, Dialog);
Vue.component(Autocomplete.name, Autocomplete);
Vue.component(Dropdown.name, Dropdown);
+ Vue.component(DropdownMenu.name, DropdownMenu);
Vue.component(DropdownItem.name, DropdownItem);
Vue.component(Menu.name, Menu);
Vue.component(Submenu.name, Submenu);
@@ -133,6 +135,7 @@ module.exports = {
Dialog,
Autocomplete,
Dropdown,
+ DropdownMenu,
DropdownItem,
Menu,
Submenu,