basic-usage.vue 836 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <kk-button text type="primary" @click="dialogVisible = true">
  3. 打开对话框
  4. </kk-button>
  5. <kk-dialog
  6. v-model="dialogVisible"
  7. title="Tips"
  8. width="30%"
  9. :before-close="handleClose"
  10. >
  11. <span>This is a message</span>
  12. <template #footer>
  13. <span class="dialog-footer">
  14. <kk-button @click="dialogVisible = false">Cancel</kk-button>
  15. <kk-button type="primary" @click="dialogVisible = false">
  16. Confirm
  17. </kk-button>
  18. </span>
  19. </template>
  20. </kk-dialog>
  21. </template>
  22. <script lang="ts" setup>
  23. import { ref } from 'vue'
  24. import { KkButton, KkDialog } from 'kankan-components'
  25. const dialogVisible = ref(false)
  26. const handleClose = (done: () => void) => {
  27. done()
  28. }
  29. </script>
  30. <style scoped>
  31. .dialog-footer button:first-child {
  32. margin-right: 10px;
  33. }
  34. </style>