@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
56 lines (55 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
var _default = props => {
const {
children,
href,
unmountHandle,
jumpFun,
iframeJump,
...rest
} = props;
if (window.__isMultiTab__) {
return /*#__PURE__*/_react.default.createElement("a", {
onClick: evt => {
var _window, _window2;
evt.preventDefault();
if (unmountHandle && typeof unmountHandle === 'function') {
unmountHandle();
}
let pathName = href;
if (href && href.includes('?')) {
pathName = href == null ? void 0 : href.split('?')[0];
}
if (jumpFun && typeof jumpFun === 'function') {
jumpFun(href);
return;
}
const isInIframe = ((_window = window) == null ? void 0 : _window.self) !== ((_window2 = window) == null ? void 0 : _window2.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);
}
return /*#__PURE__*/_react.default.createElement("a", _extends({
href: href
}, rest), children);
};
exports.default = _default;