!
也想出现在这里? 联系我们
广告位

Ant Design Vue 4.0 a-modal弹窗组件封装

父组件(部分)

<template>
    <div class="main">
        <a-button type="primary" ghost @click="dialogPanelStatus.signIngInfoStatus = true" >签约信息</a-button>
    </div>
    <!-- 签约信息 -->
    <SigningInfo
      :signIngInfoStatus="dialogPanelStatus.signIngInfoStatus"
      :walletData="walletData"
      @closeDialog="closeDialog"
    />
  </template>
  <script setup lang="ts">
  import SigningInfo from '@/components/Income/SigningInfo.vue';
  // DIalog弹窗状态
  const dialogPanelStatus = reactive<DialogPanelStatus>({
    signIngInfoStatus: false
  });
  // 数据重载
  const getMyWalletFn = ()=>{
    // 数据重载
  }
  // 关闭弹窗
  const closeDialog = (k: keyof DialogPanelStatus, rest: boolean) => {
    dialogPanelStatus[k] = false;
    rest && getMyWalletFn(true);
  };
  </script>
  
  <style lang="less" scoped>
  @import 'Income.less';
  </style>

弹窗子组件

<template>
  <a-modal :open="visible" title="弹框" :footer="null" destroyOnClose :maskClosable="false"
    @cancel="closeDialogFn(false)">
    <div class="zb-info">
      <a-card size="small" hoverable>
        <p>真实姓名:{{ walletData.real_name }}</p>
      </a-card>
      <a-card size="small" hoverable>
        <p>身份证号:{{ walletData.card_number }}</p>
      </a-card>
      <a-card size="small" hoverable>
        <p>支付宝账号:{{ walletData.alipay_account }}</p>
      </a-card>
      <a-card size="small" hoverable>
        <p>支付宝姓名:{{ walletData.alipay_name }}</p>
      </a-card>
    </div>
  </a-modal>
</template>
<script setup lang="ts">
import { toRefs } from 'vue';
import type { WalletData } from '@/types/index';
const props = withDefaults(
  defineProps<{
    visible: Boolean;
    walletData: WalletData;
  }>(),
  {}
);

const { visible, walletData } = toRefs(props);
  
// 关闭弹窗
const emits = defineEmits(['closeDialog']);
const closeDialogFn = (rest: boolean = false) => {
  emits('closeDialog', 'visibleStatus', rest);
};
</script>
<style lang="less" scoped>
@import 'SigningInfo.less';
</style>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
网创项目

让电脑右下角任务栏显示网速和内存:Traffic Monitor V1.84绿色版

2023-11-5 21:28:22

网创项目

模板兔Modown主题自定义修改记录

2024-1-24 23:40:06

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索