BasicModal.vue 976 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <uni-popup v-bind="$attrs" ref="popup" @change="handleChange" :is-mask-click="isMack" :safe-area='false'>
  3. <slot></slot>
  4. </uni-popup>
  5. </template>
  6. <script setup>
  7. import { ref, computed, unref, watch } from 'vue';
  8. const props = defineProps({
  9. open: { type: Boolean, default: false },
  10. isMack: { type: Boolean, default: true }
  11. })
  12. const emit = defineEmits(['update:open'])
  13. const popup = ref()
  14. const getOpen = computed({
  15. get: () => props.open,
  16. set: val => emit('update:open', val)
  17. })
  18. watch(getOpen, (v) => {
  19. const p = unref(popup);
  20. if (!p) return;
  21. v ? p.open() : p.close();
  22. })
  23. function handleChange({ show }){
  24. getOpen.value = show
  25. }
  26. </script>
  27. <style scoped lang="scss">
  28. /* 高于 TabBar(z-index:99),弹窗盖住底部导航 */
  29. :deep(.uni-popup) {
  30. z-index: 99999 !important;
  31. top: 0 !important;
  32. left: 0 !important;
  33. right: 0 !important;
  34. bottom: 0 !important;
  35. }
  36. :deep(.uni-popup__wrapper) {
  37. z-index: 99999 !important;
  38. }
  39. </style>