lib
This commit is contained in:
parent
34bfd87bb6
commit
7c3b649b67
|
|
@ -26,6 +26,8 @@ export interface AMapProps extends APILoaderProps {
|
|||
useAMapUI?: boolean;
|
||||
uiVersion?: string;
|
||||
uiCallback?: (status: 'success' | 'fail', result?: any) => void;
|
||||
securityJsCode?: string;
|
||||
serviceHost?: string;
|
||||
}
|
||||
declare const memo: (props: AMapProps) => JSX.Element;
|
||||
export default memo;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,23 @@ var classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|||
require("./index.less");
|
||||
;
|
||||
var memo = function (props) {
|
||||
var akey = props.akey, version = props.version, className = props.className, style = props.style, children = props.children, _a = props.mapProps, mapProps = _a === void 0 ? {} : _a, mapRef = props.mapRef, useAMapUI = props.useAMapUI, _b = props.uiVersion, uiVersion = _b === void 0 ? '1.1' : _b, uiCallback = props.uiCallback;
|
||||
var akey = props.akey, securityJsCode = props.securityJsCode, serviceHost = props.serviceHost, version = props.version, className = props.className, style = props.style, children = props.children, _a = props.mapProps, mapProps = _a === void 0 ? {} : _a, mapRef = props.mapRef, useAMapUI = props.useAMapUI, _b = props.uiVersion, uiVersion = _b === void 0 ? '1.1' : _b, uiCallback = props.uiCallback;
|
||||
var prefixCls = 'oak';
|
||||
(0, react_1.useEffect)(function () {
|
||||
// 对安全密钥的支持
|
||||
if (serviceHost || securityJsCode) {
|
||||
if (serviceHost) {
|
||||
window._AMapSecurityConfig = {
|
||||
serviceHost: "".concat(serviceHost, "/_AMapService"),
|
||||
};
|
||||
}
|
||||
else {
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: securityJsCode,
|
||||
};
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
(0, react_1.useEffect)(function () {
|
||||
if (!useAMapUI) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue