一.举例:对于 echatrs 的柱子分别需要弹窗 带参数  触发弹窗出现事件 showModalhref
   myChart.on('click', (params) => {
switch (params.seriesIndex) {
// echarts 双柱1
case 0: this.showModalhref('kjxy', industryBar_list.list, params);
break;
// echarts 双柱2
case 1: this.showModalhref('cpxy', industryBar_list.list, params);
break;
default: break;
}
});

二、modal  

   state = {
  modalShowHref: {
visibleHref: false,
type: '',
data1: [],
data2: {},
},
 } <Modal
visible={this.state.modalShowHref.visibleHref}
onOk={this.okModalhref}
onCancel={this.hideModalhref}
okText="确认"
cancelText="取消"
width={278}
className={styles.hrefModal}
>
<p>确定跳转吗?</p>
</Modal>

  三、点击onOk时

okModalhref = () => {
const { modalShowHref } = this.state;
const { type } = modalShowHref;
const { data1 } = modalShowHref;
const { data2 } = modalShowHref;
if (type === 'kjxy') { // 框架协议 (arr, params)
const obj = data1.find(t => t.name === data2.name);
const { corpCstTps } = obj;
this.props.dispatch(routerRedux.push({
pathname: '/QYGL/kjxy/query',
state: {
corpCstTps,
},
}));
} else if (type === 'cpxy') { // 产品协议 (arr, params)
const obj = data1.find(t => t.name === data2.name);
const { corpCstTps } = obj;
this.props.dispatch(routerRedux.push({
pathname: '/QYGL/cpxy/searchList',
state: {
corpCstTps,
},
}));
}
};

四、点击onCancel时

/////弹窗中 取消事件
hideModalhref = () => {
this.setState({
modalShowHref: {
visibleHref: false,
type: '',
data1: [],
data2: {},
},
});
};

react 中 Modal 多次使用且带参数不同实现的更多相关文章

  1. JS中setInterval、setTimeout不能传递带参数的函数的解决方案

    在JS中无论是setTimeout还是setInterval,在使用函数名作为调用句柄时都不能带参数,而在许多场合必须要带参数,接下来为大家介绍具体的解决方法 在JS中无论是setTimeout还是s ...

  2. JS中setInterval、setTimeout不能传递带参数的函数的解决办法

    在JS中无论是setTimeout还是setInterval,在使用函数名作为调用句柄时都不能带参数,而在许多场合必须要带参数,这就需要想方法解决. 一.采用字符串形式:——(缺陷)参数不能被周期性改 ...

  3. JS中setInterval、setTimeout不能传递带参数的函数的解决方法

    setInterval 和 setTimeout 这两个函数比较好用,但会遇到比如说我隔个几秒后要执行的函数是带参数的,这种情况怎么办?可以用匿名函数包装处理 //不带参数的函数 function t ...

  4. 在IDEA中设置方法自动注释(带参数和返回值)

    第一部分 设置 打开设置面板 新建 在线模板 新建自动添加规则,注意 这里触发的字符 不能随便写 必须为 * Template text 区域 看上去有点乱,但是是为了显示时的对齐,该区域的内容如下( ...

  5. 【转】如何在命令行脚本中启动带参数的Windows服务

    我们有一个自己编写的Windows服务,我们希望该服务在启动时可以根据用户输入的参数实现不同的功能. 要实现这样的需求并不是很难,下面这个例子我用来示范如何编写该服务 using System; us ...

  6. JavaScript学习笔记 -- 带参数arguments的函数的用法

    JavaScript函数有带参数与不带参数两种形式,不带参数情况如下: function myFunction() { alert('HelloWorld!') } 在这种类型的函数中,输出值是确定的 ...

  7. C#线程调用带参数的方法

    在 .NET Framework 2.0 版中,要实现线程调用带参数的方法有两种办法.第一种:使用ParameterizedThreadStart.调用 System.Threading.Thread ...

  8. Qt配置cmake;运行带参数的程序

    配置cmake编译器,步骤如下: 步骤1:  Qt下新建一个project. 步骤2:  在该project目录下创建一个CMakeLists.txt文件,并按规范编写该文件. Tip: projec ...

  9. thread 带参数

    在 .NET Framework 2.0 版中,要实现线程调用带参数的方法有两种办法. 第一种:使用ParameterizedThreadStart. 调用 System.Threading.Thre ...

随机推荐

  1. TinyMCE入门

    引入TinyMCE脚本 <script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" ...

  2. Java进程间通信学习

    转自:https://www.iteye.com/blog/polim-1278435 进程间通信的主要方法有:(1)管道(Pipe):管道可用于具有亲缘关系进程间的通信,允许一个进程和另一个与它有共 ...

  3. springboot+thymeleaf 实现图片文件上传及回显

    1. 创建一个springboot工程, 在此就不多说了(目录结构). 2. 写一个HTML页面 <!DOCTYPE html> <html lang="en" ...

  4. python 和 R 中的整数序列

    python 中的 range() 函数是很常用的,R  中相应的函数是 seq(), 其实,R 中的“ :”也能代替 python 中的 range() 函数. 1.生成升序整数序列 python: ...

  5. axios跨域处理

    本质分析: 因为axios在vue中利用中间件http-proxy-middleware做了一个本地的代理服务A,相当于你的浏览器通过本地的代理服务A请求了服务端B,浏览器通过服务A并没有跨域,因此就 ...

  6. macos -bash: yarn: command not found/-bash: cnpm: command not found

    -bash: cnpm: command not found-bash: yarn: command not found-bash: xxxx: command not found如上yarn/cnp ...

  7. Candy Treasure Box

    This is an interesting puzzle game. In the game, you need to use your brain, think carefully, operat ...

  8. three.js 打包为一个组-几个单独的模型

    代码: <!DOCTYPE html> <html lang="en"> <head> <title>three.js webgl ...

  9. 【线段树】【P4062】 [Code+#1]Yazid 的新生舞会

    Description 给定一个长度为 \(n\) 的序列,求有多少子区间满足区间众数严格大于区间长度的一半.如果区间有多个出现次数最多且不同的数则取较小的数为众数. Limitation 对于全部的 ...

  10. 深入js系列-类型(隐式强制转换)

    隐式强制转换 在其可控的情况下,减少冗余,让代码更简洁,很多地方都进行了隐式转换,比如常见的三目表达式.if().for().while.逻辑运算符 || &&,适当通过语言机制,抽象 ...