feat(collapse): add transition package

fix #108
This commit is contained in:
bastarder 2020-08-11 13:45:14 +08:00 committed by jeremywu
parent c2341c72eb
commit 32f02bef0b
4 changed files with 24 additions and 8 deletions

View File

@ -4,7 +4,8 @@
"main": "dist/index.js",
"license": "MIT",
"dependencies": {
"mitt": "^2.1.0"
"mitt": "^2.1.0",
"@element-plus/utils": "^0.0.0"
},
"peerDependencies": {
"vue": "^3.0.0-rc.1"
@ -12,4 +13,4 @@
"devDependencies": {
"@vue/test-utils": "^2.0.0-beta.0"
}
}
}

View File

@ -13,7 +13,7 @@
:id="`el-collapse-head-${id}`"
class="el-collapse-item__header"
role="button"
:tabindex="disabled ? undefined : 0"
:tabindex="disabled ? -1 : 0"
:class="{
'focusing': focusing,
'is-active': isActive
@ -50,8 +50,8 @@
<script lang='ts'>
import { defineComponent, PropType, inject, computed, ref } from 'vue'
import { CollapseProvider } from './collapse.vue'
import { generateId } from '../../utils/util'
import ElCollapseTransition from '../../transitions/collapse-transition.vue'
import { generateId } from '@element-plus/utils/util'
import ElCollapseTransition from '@element-plus/transition/collapse-transition/index.vue'
export default defineComponent({
name: 'ElCollapseItem',
@ -98,13 +98,13 @@ export default defineComponent({
const handleHeaderClick = () => {
if(props.disabled) return
collapseMitt && collapseMitt.emit('item-click', props.name)
collapseMitt?.emit('item-click', props.name)
focusing.value = false
isClick.value = true
}
const handleEnterClick = () => {
collapseMitt && collapseMitt.emit('item-click', props.name)
collapseMitt?.emit('item-click', props.name)
}
return {

View File

@ -5,7 +5,7 @@
</transition>
</template>
<script lang='ts'>
import { addClass, removeClass } from '../utils/dom'
import { addClass, removeClass } from '@element-plus/utils/dom'
export default {
name: 'ElCollapseTransition',

View File

@ -0,0 +1,15 @@
{
"name": "@element-plus/transition",
"version": "0.0.0",
"main": "dist/index.js",
"license": "MIT",
"dependencies": {
"@element-plus/utils": "^0.0.0"
},
"peerDependencies": {
"vue": "^3.0.0-rc.1"
},
"devDependencies": {
"@vue/test-utils": "^2.0.0-beta.0"
}
}