根据每种条件显示警报

发布于 2025-02-05 10:47:53 字数 646 浏览 0 评论 0原文

我有几个后端的条件 II希望根据ANTD模式类似的条件打印一个警报,

Modal.confirm({
  centered: true,
  title:
    'Sorry, you cannot create Menu without satisfying  the following conditions: \n\n  name\n nameclass \n ageover, \n numberclass.',
  okText: 'okay',
  cancelText: 'cancel',
  onOk: () => {
    this.props.setForm('');
  },
});

但需要显示标题中所需的字段基于后端的数据。喜欢,

res.data = {nameVal:'jan',组:null,numberClass:5,ageover:21}

因此需要表现为基于此结果的字段。如果

res.data = {nameVal:'',group:null,numberClass:0,ageover:0}

在这种需要中以模态显示每个条件。如何从res.data中检查每个条件可用性,并根据该要求显示模态警报。如果我们设置了其他需要编写T0O许多概率的情况。

I have several conditions from backend
iI want to print an alert based on the condition in antd modal like,

Modal.confirm({
  centered: true,
  title:
    'Sorry, you cannot create Menu without satisfying  the following conditions: \n\n  name\n nameclass \n ageover, \n numberclass.',
  okText: 'okay',
  cancelText: 'cancel',
  onOk: () => {
    this.props.setForm('');
  },
});

But need show the required fields in the title is based on the data from backend. like,

res.data={ nameval: 'jan', group:null, numberclass:5, ageover:21}

so required field to show as based on this result is group. If

res.data={ nameval:'', group:null, numberclass:0, ageover:0}

in this need to show each condition in modal. How to check each condition availability from res.data and show the modal alert baased on that requirment. If we set if else need to write t0o many probabilities.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖风昔人 2025-02-12 10:47:53

只需回报语句

fetch(url).then(data =>{
   return Modal.confirm({
            centered: true,
            title:data.title,
            okText: 'okay',
            cancelText: 'cancel',
            onOk: () => {
               this.props.setForm('');
            },
         });
})

Just do it in return statement

fetch(url).then(data =>{
   return Modal.confirm({
            centered: true,
            title:data.title,
            okText: 'okay',
            cancelText: 'cancel',
            onOk: () => {
               this.props.setForm('');
            },
         });
})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文