You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.3 KiB
73 lines
1.3 KiB
<script>
|
|
export default {
|
|
name: 'CustomTopPopup',
|
|
props: {
|
|
modelValue: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
computed: {
|
|
show() {
|
|
return this.modelValue
|
|
}
|
|
},
|
|
methods: {
|
|
closePopup() {
|
|
console.log('关闭弹窗')
|
|
this.$emit('update:modelValue', false)
|
|
},
|
|
handleMaskClick() {
|
|
console.log('点击遮罩')
|
|
this.closePopup()
|
|
}
|
|
},
|
|
mounted() {
|
|
console.log('CustomTopPopup mounted, modelValue:', this.modelValue)
|
|
},
|
|
watch: {
|
|
modelValue(newVal) {
|
|
console.log('CustomTopPopup modelValue changed:', newVal)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<view v-if="show" class="top-popup-mask" @tap="handleMaskClick">
|
|
<view class="top-popup-content" @tap.stop>
|
|
<slot />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
.top-popup-mask {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, 0.6);
|
|
z-index: 1001;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.top-popup-content {
|
|
background: #fff;
|
|
border-bottom-left-radius: 24rpx;
|
|
border-bottom-right-radius: 24rpx;
|
|
animation: slideDown 0.3s ease-out;
|
|
width: 100%;
|
|
}
|
|
|
|
@keyframes slideDown {
|
|
from {
|
|
transform: translateY(-100%);
|
|
}
|
|
to {
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
</style>
|