react 弹出并打开新窗口 引入public中的图片


// 首先配置路由并隐藏菜单栏
const routes = [
  {
  name: '投保综合查询保单详情页',
    icon: 'smile',
    path: '/insureOfQuery/components/details',
    component: './InsureOfQuery/components/Details',
    // 隐藏菜单栏
    menuRender: false,
    // 隐藏菜单
    hideInMenu: true,
  }
];

 

export default routes;
 
 
const jumpDetails = () => {
  const url = '/insureOfQuery/components/details?需要传递的数据' + ’需要传递的数据‘
  window.open(url, '_blank', 'height=955,width=1269')?.focus() // 设置宽高 为 新页面 大小   _blank 代表新页面展示
}
 
//如何在新页面获取数据
 
useEffect(() => {
    // 获取信息
    let obj = window.location
    console.log(obj, 'obj');
}, [])
// 打印出window.location   会在search属性中看到传递的字符串信息   通过截取 获得自己想要的参数
 
在表格columns中配置
{
    title: '投保单号',
    width: 300,
    align: 'center',
    dataIndex: 'callNumber',
    render: (callNumber) => <a style={{color: 'black'}} onClick={jumpDetails}>
      {callNumber}
    </a>
},
 
 
 
  
 
 
如图所示 如果 直接引入public下的图片   直接 引入就可以
export default () => {
  return (
    <ProCard bordered>
      <img src="/logo.png"/>
    </ProCard>
  )
}
 
如果是icon文件下    <img src="/icons/icon-128×128.png"/>    


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM