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.68 kB
"use strict"; var _excluded = ["children", "href", "unmountHandle", "jumpFun", "iframeJump"]; function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; } 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 = function _default(props) { var children = props.children, href = props.href, unmountHandle = props.unmountHandle, jumpFun = props.jumpFun, iframeJump = props.iframeJump, rest = _objectWithoutProperties(props, _excluded); if (window.__isMultiTab__) { return /*#__PURE__*/_react["default"].createElement("a", { onClick: function onClick(evt) { var _window, _window2; evt.preventDefault(); if (unmountHandle && typeof unmountHandle === 'function') { unmountHandle(); } var pathName = href; if (href && href.includes('?')) { pathName = href == null ? void 0 : href.split('?')[0]; } if (jumpFun && typeof jumpFun === 'function') { jumpFun(href); return; } var 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;