|
@@ -1,9 +1,12 @@
|
|
<script>
|
|
<script>
|
|
import Clickoutside from 'main/utils/clickoutside';
|
|
import Clickoutside from 'main/utils/clickoutside';
|
|
|
|
+ import emitter from 'main/mixins/emitter';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'ElDropdown',
|
|
name: 'ElDropdown',
|
|
|
|
|
|
|
|
+ mixins: [emitter],
|
|
|
|
+
|
|
directives: { Clickoutside },
|
|
directives: { Clickoutside },
|
|
|
|
|
|
props: {
|
|
props: {
|
|
@@ -32,6 +35,12 @@
|
|
this.initEvent();
|
|
this.initEvent();
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ watch: {
|
|
|
|
+ visible(val) {
|
|
|
|
+ this.broadcast('ElDropdownMenu', 'visible', val);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
methods: {
|
|
methods: {
|
|
show() {
|
|
show() {
|
|
clearTimeout(this.timeout);
|
|
clearTimeout(this.timeout);
|
|
@@ -74,8 +83,7 @@
|
|
},
|
|
},
|
|
|
|
|
|
render(h) {
|
|
render(h) {
|
|
- let { hide, splitButton, visible, type } = this;
|
|
|
|
- let dropdownElm = visible ? this.$slots.dropdown : null;
|
|
|
|
|
|
+ let { hide, splitButton, type } = this;
|
|
|
|
|
|
var handleClick = _ => {
|
|
var handleClick = _ => {
|
|
this.$emit('click');
|
|
this.$emit('click');
|
|
@@ -95,9 +103,7 @@
|
|
return (
|
|
return (
|
|
<div class="el-dropdown" v-clickoutside={hide}>
|
|
<div class="el-dropdown" v-clickoutside={hide}>
|
|
{triggerElm}
|
|
{triggerElm}
|
|
- <transition name="md-fade-bottom">
|
|
|
|
- {dropdownElm}
|
|
|
|
- </transition>
|
|
|
|
|
|
+ {this.$slots.dropdown}
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|