解决antd message多次点击弹出多个信息提示

点击一个按钮,提示一条信息,多次点击,提示出多条相同的提示
在这里插入图片描述
解决办法:
弹窗前先删除
``
message.destroy();
message.info(‘正在开发,敬请期待!’);

  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
要实现antdvue中点击树节点弹出该树节点的信息框,可以按照以下步骤来进行: 1. 在父组件中定义一个选中的节点变量,用于存储当前选中的树节点。 2. 在树组件中添加一个@click事件,在该事件中将当前点击的节点赋值给选中的节点变量。 3. 在父组件中通过监听选中的节点变量的变化,来弹出对应节点的信息框。 具体代码如下: ``` <template> <div> <a-tree :tree-data="treeData" :default-expand-all="true" @click="handleClick"></a-tree> <a-modal v-if="selectedNode" :title="selectedNode.title" :visible="true" @cancel="handleCancel"> <p>{{ selectedNode.content }}</p> </a-modal> </div> </template> <script> import { Tree, Modal } from 'ant-design-vue'; export default { components: { 'a-tree': Tree, 'a-modal': Modal, }, data() { return { treeData: [ { title: 'Node1', key: '1', content: 'This is the content of Node1', children: [ { title: 'Child Node1', key: '1-1', content: 'This is the content of Child Node1', }, { title: 'Child Node2', key: '1-2', content: 'This is the content of Child Node2', }, ], }, { title: 'Node2', key: '2', content: 'This is the content of Node2', }, ], selectedNode: null, }; }, methods: { handleClick(node) { this.selectedNode = node; }, handleCancel() { this.selectedNode = null; }, }, }; </script> ``` 在上述代码中,定义了一个树形组件,其中每个节点都有一个title和一个content属性,分别代表节点的标题和内容。在点击节点时,将当前节点赋值给selectedNode变量,然后在父组件中通过v-if指令来控制是否弹出信息框,并将selectedNode的title和content分别传递给信息框的标题和内容。在点击信息框的取消按钮时,将selectedNode变量重置为null,关闭信息框。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值