• vue3后台管理系统封装的弹窗组件


    弹窗组件效果

     ComModelR.vue组件

    1. <script setup>
    2. import { reactive, ref, onBeforeMount } from 'vue';
    3. import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
    4. const props = defineProps({
    5. span: {
    6. type: Number,
    7. default: 8
    8. },
    9. title: {
    10. type: String,
    11. default: ''
    12. },
    13. width: {
    14. type: Number,
    15. default: 800
    16. },
    17. wrapClassName: {
    18. type: String,
    19. default: ''
    20. },
    21. formList: {
    22. type: Array,
    23. default: () => ([]),
    24. },
    25. rulesRef: {
    26. type: Function,
    27. default: () => [],
    28. },
    29. bodyStyle: {
    30. type: Object,
    31. default: null
    32. },
    33. formItemLayout: {
    34. type: Object,
    35. default:
    36. {
    37. labelCol: { xs: { span: 24 }, sm: { span: 9 } },
    38. wrapperCol: { xs: { span: 24 }, sm: { span: 15 } }
    39. }
    40. },
    41. buttntitle: {
    42. type: String,
    43. default: '返回'
    44. },
    45. })
    46. const bodyStyle = {
    47. background: '#f0f2f5',
    48. padding: '10px 10px 1px',
    49. minHeight: `431px`
    50. }
    51. const { formItemLayout } = props
    52. const visible = ref(false);
    53. // const formRef = ref();
    54. let formState = ref({});
    55. const showModal = (param, param2) => {
    56. visible.value = param;
    57. formState.value = param2 ? param2 : {}
    58. // console.log(param, '5555555dddddddddd')
    59. };
    60. const emits = defineEmits(['addoredittable','handleCancelModal'])
    61. const handleOk = (values) => {
    62. // values = { ...values, ...formState.value }
    63. // visible.value = false;
    64. // switch (props.title) {
    65. // case '修改':
    66. // formRef.value.resetFields()
    67. // emits('addoredittable', 'edit', values)
    68. // break;
    69. // case '添加':
    70. // // props.addapi('dddd')
    71. // emits('addoredittable', 'add', values)
    72. // formRef.value.resetFields()
    73. // }
    74. };
    75. const handleCancel = () => {
    76. visible.value = false;
    77. // formRef.value.resetFields()
    78. emits("handleCancelModal");
    79. };
    80. defineExpose({
    81. showModal, handleOk, handleCancel, formState
    82. });
    83. script>

    使用:

    1. <ComModelR ref="modalRef" :title="modalTitle" :width="1200">
    2. <div class="modalBox">
    3. <SearchItem :searchitemList="SearchitemList" @handleSearch="handleSearchModal">SearchItem>
    4. <ComtableListR ref="tableModalRef" :hasImport="false" :hasExport="false"
    5. :dividerbutton="modalDividerbutton" :operatingButton="modalOperatingButton" @getData="getModalData"
    6. :columns="modalColumns" :loading="modalLoading" />
    7. div>
    8. ComModelR>

    其中两个组件前面文章都提到了。

    1. //点击事件,弹窗出现
    2. const openModal = (param, param2) => {
    3. MonitorItemId.value = param
    4. modalTitle.value = param2.title
    5. modalRef.value.showModal(true)
    6. getModalData()
    7. }

  • 相关阅读:
    逻辑回归中对L1\L2正则化的理解
    perl学习笔记(九)用正则表达式处理文本(2)
    银行业务测试
    一些概念梳理
    uniapp视频播放功能
    微软黑科技如何加速游戏开发,读这篇就够了
    wpf devexpress实现输入验证使用验证规则
    k8s pod概念、分类及策略
    Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
    Linux系统编程--IO
  • 原文地址:https://blog.csdn.net/qq_46617584/article/details/131805365