add submenu transition (#2298)

pull/2301/head
baiyaaaaa 2017-01-09 15:50:47 +08:00 committed by cinwell.li
parent ad2a32dcd6
commit d3f62b7974
5 changed files with 23 additions and 8 deletions

View File

@ -6,6 +6,7 @@ var saladConfig = require('../packages/theme-default/salad.config.json');
var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
var transitionList = fs.readdirSync(path.resolve(__dirname, '../src/transitions'));
var externals = {};
Object.keys(Components).forEach(function(key) {
@ -21,6 +22,10 @@ mixinsList.forEach(function(file) {
file = path.basename(file, '.js');
externals[`element-ui/src/mixins/${file}`] = `element-ui/lib/mixins/${file}`;
});
transitionList.forEach(function(file) {
file = path.basename(file, '.js');
externals[`element-ui/src/transitions/${file}`] = `element-ui/lib/transitions/${file}`;
});
externals = [Object.assign({
vue: 'vue'

View File

@ -15,14 +15,20 @@
}">
</i>
</div>
<transition :name="rootMenu.mode === 'horizontal' ? 'el-zoom-in-top' : ''">
<template v-if="rootMenu.mode === 'horizontal'">
<transition name="el-zoom-in-top">
<ul class="el-menu" v-show="opened"><slot></slot></ul>
</transition>
</template>
<collapse-transition v-else>
<ul class="el-menu" v-show="opened"><slot></slot></ul>
</transition>
</collapse-transition>
</li>
</template>
<script>
import menuMixin from './menu-mixin';
import Emitter from 'element-ui/src/mixins/emitter';
import CollapseTransition from 'element-ui/src/transitions/collapse-transition';
module.exports = {
name: 'ElSubmenu',
@ -31,6 +37,10 @@
mixins: [menuMixin, Emitter],
components: {
CollapseTransition
},
props: {
index: {
type: String,

View File

@ -1,8 +1,6 @@
<template>
<div class="el-tab-pane">
<div class="el-tab-pane__content" v-show="active">
<slot></slot>
</div>
<div class="el-tab-pane" v-show="active">
<slot></slot>
</div>
</template>
<script>

View File

@ -43,7 +43,7 @@
</template>
<script type="text/jsx">
import CollapseTransition from './transition';
import CollapseTransition from 'element-ui/src/transitions/collapse-transition';
import ElCheckbox from 'element-ui/packages/checkbox';
export default {

View File

@ -3,6 +3,7 @@ class Transition {
if (!el.dataset) el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldDisplay = el.style.display;
el.style.height = '0';
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
@ -55,7 +56,8 @@ class Transition {
}
afterLeave(el) {
el.style.display = el.style.height = '';
el.style.display = el.dataset.oldDisplay;
el.style.height = '';
el.style.overflow = el.dataset.oldOverflow;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;