Skip to content

Commit

Permalink
fix: fix collapse-transition register error & export collapse-transit…
Browse files Browse the repository at this point in the history
…ion component
  • Loading branch information
ImJustAMan committed Nov 26, 2020
1 parent 11385fb commit 5847f0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/entry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 用于构建时的入口
import ElCollapseTransition from './transitions/collapse-transition'
// Basic
import ElRow from '../packages/row'
import ElCol from '../packages/col'
Expand Down Expand Up @@ -171,7 +172,8 @@ const components = [
ElInfiniteScroll,
ElDrawer,
ElScrollbar,
ElAutocomplete
ElAutocomplete,
ElCollapseTransition
]

const install = (app, opts = {}) => {
Expand Down Expand Up @@ -268,6 +270,7 @@ export {
ElCard,
ElCollapse,
ElCollapseItem,
ElCollapseTransition,
ElTimeline,
ElTimelineItem,
ElDivider,
Expand Down
11 changes: 8 additions & 3 deletions src/transitions/collapse-transition.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addClass, removeClass } from '../../src/utils/dom'
import { addClass, removeClass } from '../utils/dom'
import { h, Transition } from 'vue'

class TransitionFn {
Expand Down Expand Up @@ -65,7 +65,8 @@ class TransitionFn {
}
}

const ElCollapseTransition = (props, { slots }) => {
const ElCollapseTransition = (props, context) => {
console.log(context)
const transitions = new TransitionFn()
const data = {
onBeforeEnter: transitions.beforeEnter,
Expand All @@ -75,7 +76,11 @@ const ElCollapseTransition = (props, { slots }) => {
onLeave: transitions.leave,
onAfterLeave: transitions.afterLeave
}
return h(Transition, data, slots)
return h(Transition, data, context.slots)
}

ElCollapseTransition.install = function (app) {
app.component('ElCollapseTransition', ElCollapseTransition)
}

export default ElCollapseTransition

0 comments on commit 5847f0e

Please sign in to comment.