|
|
<template>
|
|
|
<transition name="action-sheet-fade">
|
|
|
<Popup
|
|
|
class="yoho-action-sheet"
|
|
|
type="yoho-action-sheet"
|
|
|
:center="false"
|
|
|
:mask="true"
|
|
|
:z-index="zIndex"
|
|
|
v-show="isVisible"
|
|
|
@mask-click="maskClick"
|
|
|
>
|
|
|
<transition name="action-sheet-move">
|
|
|
<div class="detail" v-show="isVisible">
|
|
|
<slot></slot>
|
|
|
</div>
|
|
|
</transition>
|
|
|
</Popup>
|
|
|
</transition>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {Popup} from 'cube-ui';
|
|
|
|
|
|
export default {
|
|
|
name: 'YohoActionSheet',
|
|
|
props: {
|
|
|
maskClosable: {
|
|
|
type: Boolean,
|
|
|
default: true
|
|
|
},
|
|
|
zIndex: {
|
|
|
type: Number,
|
|
|
default: 100
|
|
|
},
|
|
|
visible: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
isVisible: false,
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.$watch('visible', (newVal) => {
|
|
|
if (newVal) {
|
|
|
this.show();
|
|
|
} else {
|
|
|
this.hide();
|
|
|
}
|
|
|
}, {
|
|
|
immediate: true
|
|
|
});
|
|
|
},
|
|
|
components: {
|
|
|
Popup
|
|
|
},
|
|
|
methods: {
|
|
|
maskClick() {
|
|
|
this.maskClosable && this.cancel();
|
|
|
},
|
|
|
|
|
|
cancel() {
|
|
|
this.hide();
|
|
|
this.$emit('cancel');
|
|
|
},
|
|
|
|
|
|
show() {
|
|
|
this.isVisible = true;
|
|
|
},
|
|
|
|
|
|
hide() {
|
|
|
this.isVisible = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.action-sheet-fade-enter,
|
|
|
.action-sheet-fade-leave-active {
|
|
|
opacity: 0;
|
|
|
}
|
|
|
|
|
|
.action-sheet-fade-enter-active,
|
|
|
.action-sheet-fade-leave-active {
|
|
|
transition: all 0.3s ease-in-out;
|
|
|
}
|
|
|
|
|
|
.action-sheet-move-enter,
|
|
|
.action-sheet-move-leave-active {
|
|
|
transform: translate3d(0, 100%, 0);
|
|
|
}
|
|
|
|
|
|
.action-sheet-move-enter-active,
|
|
|
.action-sheet-move-leave-active {
|
|
|
transition: all 0.3s ease-in-out;
|
|
|
}
|
|
|
|
|
|
.yoho-action-sheet {
|
|
|
.cube-popup-content {
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.detail {
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
</style> |
...
|
...
|
|