update autocomplete

This commit is contained in:
baiyaaaaa 2016-08-12 12:19:06 +08:00
parent cf16180a71
commit a4a0701ab5
3 changed files with 22 additions and 23 deletions

View File

@ -44,9 +44,8 @@
"purecss": "^0.6.0",
"q": "^1.4.1",
"uppercamelcase": "^1.1.0",
"vue": "^2.0.0-beta.7",
"vue-loader": "^9.3.2",
"vue": "^2.0.0-beta.8",
"vue": "^2.0.0-rc.1",
"vue-markdown-loader": "^0.4.0",
"vue-popup": "^0.2.1",
"vue-router": "^2.0.0-beta.2"

View File

@ -24,17 +24,15 @@
}
}
},
ready() {
mounted() {
document.body.appendChild(this.$el);
// this.$el.appendTo('body');
this.$nextTick(() => {
this.popper = new Popper(this.$parent.$el, this.$el, { gpuAcceleration: false, placement: `bottom-${this.menuAlign}` });
});
},
beforeDestroy() {
this.$remove();
destroyed() {
setTimeout(() => {
this.popper.destroy();
}, 300);

View File

@ -1,34 +1,36 @@
<template>
<div class="el-dropdown"
:class="{'el-dropdown--text': type === 'text'}"
v-clickoutside="hide()"
v-clickoutside="hide"
>
<!-- 带独立的下拉菜单按钮 -->
<!-- 分割的下拉按钮 -->
<el-button-group v-if="iconSeparate">
<el-button :size="size" :type="type" @click="$emit('mainclick')">{{text}}</el-button>
<el-button :size="size" :type="type" @click.native="$emit('mainclick')">{{text}}</el-button>
<el-button
:size="size"
:type="type"
class="el-dropdown__icon-button"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
@click="handleClick">
@mouseenter.native="handleMouseEnter"
@mouseleave.native="handleMouseLeave"
@click.native="handleClick">
<i class="el-dropdown__icon el-icon-caret-bottom"></i>
</el-button>
</el-button-group>
<!-- 带独立的下拉菜单按钮 -->
<el-button :size="size" :type="type" @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave" @click="handleClick" v-else>
<!-- 分割的下拉按钮 -->
<el-button :size="size" :type="type" @mouseenter.native="handleMouseEnter" @mouseleave.native="handleMouseLeave" @click.native="handleClick" v-else>
{{text}}<i class="el-dropdown__icon el-icon-caret-bottom"></i>
</el-button>
<!-- 下拉菜单 -->
<el-dropdown-menu
v-ref:menu
v-if="visible"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
>
<slot></slot>
</el-dropdown-menu>
<transition name="md-fade-bottom">
<el-dropdown-menu
ref:menu
v-if="visible"
@mouseenter.native="handleMouseEnter"
@mouseleave.native="handleMouseLeave"
>
<slot></slot>
</el-dropdown-menu>
</transition>
</div>
</template>
<script>
@ -42,7 +44,7 @@
import ElButtonGroup from 'packages/button-group/index.js';
import ElDropdownMenu from './dropdown-menu.vue';
import Vue from 'vue';
import VueClickoutside from 'vue-clickoutside';
import VueClickoutside from 'main/utils/clickoutside.js';
Vue.use(VueClickoutside);
export default {