This commit is contained in:
van
2026-09-06 16:42:43 +08:00
parent cddd33db7e
commit dd4832f653
4 changed files with 113 additions and 3 deletions
@@ -0,0 +1,87 @@
<template>
<transition name="mfa-slide">
<div v-show="visible" class="mobile-floating-actions">
<slot />
</div>
</transition>
</template>
<script>
export default {
name: 'MobileFloatingActions',
data() {
return {
keyboardOpen: false
}
},
computed: {
visible() {
return !this.keyboardOpen
}
},
mounted() {
if (window.visualViewport) {
this._onViewportResize = () => {
const vv = window.visualViewport
this.keyboardOpen = window.innerHeight - vv.height > 120
}
window.visualViewport.addEventListener('resize', this._onViewportResize)
window.visualViewport.addEventListener('scroll', this._onViewportResize)
}
},
beforeDestroy() {
if (window.visualViewport && this._onViewportResize) {
window.visualViewport.removeEventListener('resize', this._onViewportResize)
window.visualViewport.removeEventListener('scroll', this._onViewportResize)
}
}
}
</script>
<style lang="scss" scoped>
.mobile-floating-actions {
position: fixed;
left: 12px;
right: 12px;
bottom: calc(72px + env(safe-area-inset-bottom, 0px));
z-index: 999;
display: flex;
align-items: center;
gap: 8px;
padding: 8px;
background: rgba(255, 255, 255, 0.96);
border-radius: 16px;
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
backdrop-filter: blur(10px);
::v-deep .el-button {
flex: 1;
height: 44px;
margin: 0;
border-radius: 12px;
font-size: 15px;
}
::v-deep .el-button--primary {
flex: 1.6;
font-weight: 600;
}
}
.mfa-slide-enter-active,
.mfa-slide-leave-active {
transition: transform 0.2s ease, opacity 0.2s ease;
}
.mfa-slide-enter,
.mfa-slide-leave-to {
transform: translateY(12px);
opacity: 0;
}
@media (min-width: 769px) {
.mobile-floating-actions {
display: none;
}
}
</style>