demo4.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <m-button @click="outerVisible = true">点击打开外层 Dialog</m-button>
  3. <m-dialog
  4. v-model="outerVisible"
  5. title="外层 Dialog"
  6. width="30%"
  7. >
  8. <m-dialog
  9. v-model="innerVisible"
  10. width="20%"
  11. title="内层 Dialog"
  12. append-to-body
  13. >
  14. <span>这是一段内层信息</span>
  15. <template #footer>
  16. <span class="dialog-footer">
  17. <m-button @click="innerVisible = false" style="margin-right: 20px">取消</m-button>
  18. <m-button type="primary" @click="innerVisible = false">确定</m-button>
  19. </span>
  20. </template>
  21. </m-dialog>
  22. <div>点击确定打开内层Dialog</div>
  23. <template #footer>
  24. <span class="dialog-footer">
  25. <m-button @click="outerVisible = false" style="margin-right: 20px">取消</m-button>
  26. <m-button type="primary" @click="innerVisible = true">确定</m-button>
  27. </span>
  28. </template>
  29. </m-dialog>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue-demi'
  33. const outerVisible = ref(false)
  34. const innerVisible = ref(false)
  35. </script>