Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev
This commit is contained in:
commit
86003d290f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -35,12 +35,16 @@ export interface AMapProps extends APILoaderProps {
|
|||
useAMapUI?: boolean;
|
||||
uiVersion?: string;
|
||||
uiCallback?: (status: 'success' | 'fail', result?: any) => void;
|
||||
securityJsCode?: string; //安全密钥 推荐开发模式下使用, 正式线上使用serviceHost
|
||||
serviceHost?: string; // 您的代理服务器域名或地址
|
||||
};
|
||||
|
||||
|
||||
const memo = (props: AMapProps) => {
|
||||
const {
|
||||
akey,
|
||||
securityJsCode,
|
||||
serviceHost,
|
||||
version,
|
||||
className,
|
||||
style,
|
||||
|
|
@ -53,6 +57,20 @@ const memo = (props: AMapProps) => {
|
|||
} = props;
|
||||
const prefixCls = 'oak';
|
||||
|
||||
useEffect(() => {
|
||||
// 对安全密钥的支持
|
||||
if (serviceHost || securityJsCode) {
|
||||
if (serviceHost) {
|
||||
(window as any)._AMapSecurityConfig = {
|
||||
serviceHost: `${serviceHost}/_AMapService`,
|
||||
};
|
||||
} else {
|
||||
(window as any)._AMapSecurityConfig = {
|
||||
securityJsCode,
|
||||
};
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!useAMapUI) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue