UNPKG

@tntd/reference

Version:

<!-- * @Author: 周泽飞 zefei.zhou@tongdun.net * @Date: 2024-12-03 10:07:54 * @LastEditors: 郑泳健 * @LastEditTime: 2026-01-20 15:55:03 * @FilePath: /tntd3/packages/reference/README.md * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: http

69 lines (68 loc) 2.26 kB
import React from 'react'; import { WrapLocaleReceiver } from '../I18N'; import { HandleIcon,Icon } from 'tntd'; export default WrapLocaleReceiver((props) => { const { record,onViewOpen,setOtherVisible, children, href, unmountHandle, jumpFun, iframeJump, Com, I18N, ...rest } = props; if(onViewOpen && record?.canJump){ return ( <HandleIcon className="custom-class" num={2}> <HandleIcon.Item title={I18N.referenceinfo.index.xiangqing} desc={I18N.referenceinfo.index.xiangqing}> <Icon type="profile" onClick={()=>{ const url = window.location.origin + record?.goLink; window.parent.open(url); }}></Icon> </HandleIcon.Item> </HandleIcon> )} if(onViewOpen){ return ( <HandleIcon className="custom-class" num={2}> <HandleIcon.Item title={I18N.referenceinfo.index.xiangqing} desc={I18N.referenceinfo.index.xiangqing}> <Icon type="profile" onClick={()=>{ setOtherVisible(record); }}></Icon> </HandleIcon.Item> </HandleIcon> )} if (window.__isMultiTab__) { return ( <a onClick={(evt) => { evt.preventDefault(); if (unmountHandle && typeof unmountHandle === 'function') { unmountHandle(); } let pathName = href; if (href && href.includes('?')) { pathName = href?.split('?')[0]; } if(jumpFun && typeof jumpFun==='function'){ jumpFun(href); return } const isInIframe = window?.self !== window?.top; if(iframeJump && isInIframe){ if (pathName === window.location.pathname) { window.parent.location.href = href; } else { window.parent.open(href); } return } // if (pathName === window.location.pathname) { window.location.href = href; // } else { // window.push(href); // } }} > {children} </a> ); } return ( <a href={href} {...rest}> {children} </a> ); });