|
|
@ -1,15 +1,22 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div > |
|
|
|
<div > |
|
|
|
<div :class="['mask', openDrawer ? 'open' : 'close']" @click="close"></div> |
|
|
|
<div :class="['mask', openDrawer ? 'open' : 'close']" @click="close"></div> |
|
|
|
<div :class="['drawer', openDrawer ? 'open' : 'close']"> |
|
|
|
<div :class="['drawer', placement, openDrawer ? 'open' : 'close']"> |
|
|
|
<slot></slot> |
|
|
|
<div style="position: relative; height: 100%"> |
|
|
|
|
|
|
|
<slot></slot> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="button" @click="handle"> |
|
|
|
|
|
|
|
<a-icon type="bars" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
import AIcon from 'ant-design-vue/es/icon/icon' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'Drawer', |
|
|
|
name: 'Drawer', |
|
|
|
|
|
|
|
components: {AIcon}, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
openDrawer: { |
|
|
|
openDrawer: { |
|
|
|
type: Boolean, |
|
|
|
type: Boolean, |
|
|
@ -28,6 +35,9 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
close () { |
|
|
|
close () { |
|
|
|
this.$emit('change', false) |
|
|
|
this.$emit('change', false) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handle () { |
|
|
|
|
|
|
|
this.$emit('change', !this.openDrawer) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -53,14 +63,37 @@ export default { |
|
|
|
height: 100%; |
|
|
|
height: 100%; |
|
|
|
transition: all 0.5s; |
|
|
|
transition: all 0.5s; |
|
|
|
z-index: 100; |
|
|
|
z-index: 100; |
|
|
|
&.open{ |
|
|
|
&.left{ |
|
|
|
left: 0; |
|
|
|
&.open{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
&.close{ |
|
|
|
|
|
|
|
transform: translateX(-100%); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
&.close{ |
|
|
|
&.right{ |
|
|
|
left: -100%; |
|
|
|
&.open{ |
|
|
|
|
|
|
|
right: 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
&.close{ |
|
|
|
|
|
|
|
right: -100%; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.sider{ |
|
|
|
.sider{ |
|
|
|
height: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.button{ |
|
|
|
|
|
|
|
height: 40px; |
|
|
|
|
|
|
|
width: 40px; |
|
|
|
|
|
|
|
background-color: #fff; |
|
|
|
|
|
|
|
border-radius: 0 5px 5px 0; |
|
|
|
|
|
|
|
position: fixed; |
|
|
|
|
|
|
|
left: 256px; |
|
|
|
|
|
|
|
top: 200px; |
|
|
|
|
|
|
|
z-index: 100; |
|
|
|
|
|
|
|
font-size: 26px; |
|
|
|
|
|
|
|
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15); |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
line-height: 40px; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|