fs-mask.vue 677 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <view class="fs-mask" :style="{'zIndex': zIndex}" v-if="modelValue" @click="handleMask"></view>
  3. </template>
  4. <script setup>
  5. const props = defineProps({
  6. modelValue: Boolean,
  7. zIndex: {
  8. type: Number,
  9. default: 899
  10. },
  11. maskClickable: {
  12. type: Boolean,
  13. default: true
  14. }
  15. })
  16. const emits = defineEmits(['update:modelValue','close'])
  17. const handleMask = () => {
  18. if (props.maskClickable) {
  19. emits('update:modelValue', false)
  20. emits('close')
  21. }
  22. }
  23. </script>
  24. <style lang="scss">
  25. .fs-mask{
  26. position: fixed;
  27. top: var(--window-top);
  28. right: 0;
  29. bottom: var(--window-bottom);
  30. left: 0;
  31. background-color: rgba(0, 0, 0, 0.5);
  32. backdrop-filter: blur(10rpx);
  33. }
  34. </style>