PasswordModal.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <a-modal v-model:visible="visible" :title="title" @ok="handleOk" @cancel="handleCancel">
  3. <div class="modal-container">
  4. <div class="vent-flex-row">
  5. <ExclamationCircleFilled style="color: #ffb700; font-size: 30px" />
  6. <div class="warning-text">您是否要进行{{ title }}操作?</div>
  7. </div>
  8. <div class="vent-flex-row input-box">
  9. <div class="label">操作密码:</div>
  10. <a-input size="small" type="password" v-model:value="passWord" />
  11. </div>
  12. </div>
  13. </a-modal>
  14. </template>
  15. <script setup lang="ts">
  16. import { watch, ref } from 'vue';
  17. import { ExclamationCircleFilled } from '@ant-design/icons-vue';
  18. const props = defineProps({
  19. modalIsShow: {
  20. type: Boolean,
  21. default: false,
  22. },
  23. modalTitle: {
  24. type: String,
  25. default: '',
  26. },
  27. modalType: {
  28. type: String,
  29. default: '',
  30. },
  31. });
  32. const emit = defineEmits(['handleOk', 'handleCancel']);
  33. const visible = ref<Boolean>(false);
  34. const title = ref<String>('');
  35. const type = ref<String>('');
  36. const passWord = ref('');
  37. watch([() => props.modalIsShow, () => props.modalTitle, () => props.modalType], ([newVal, newModalTitle, newModalType]) => {
  38. visible.value = newVal;
  39. if (newModalTitle) title.value = newModalTitle;
  40. if (newModalType) type.value = newModalType;
  41. passWord.value = '';
  42. });
  43. function handleOk() {
  44. //
  45. emit('handleOk', passWord.value, type.value);
  46. }
  47. function handleCancel() {
  48. //
  49. emit('handleCancel');
  50. }
  51. </script>
  52. <style scoped lang="less">
  53. @ventSpace: zxm;
  54. .label {
  55. width: 80px;
  56. }
  57. .@{ventSpace}-input {
  58. width: 150px;
  59. }
  60. </style>