npm install --save react-fengmap
完整 API 使用文档,请这边走
// 基础地图
import React, { Component } from 'react'
import fengmapSDK from 'fengmap'
import { FengmapBase } from 'react-fengmap'
class Example extends Component {
render() {
return (
<FengmapBase
fengmapSDK={fengmapSDK}
mapId="10347"
mapOptions={{
key: '你的key',
//开发者申请应用名称
appName: '你的应用',
defaultMapScaleLevel: 20,
defaultTiltAngle: 45
}}
style={{
width: '800px',
height: '550px'
}}
/>
)
}
}
// 带楼层控制的地图
import React, { Component } from 'react'
import fengmapSDK from 'fengmap'
import { FengmapFloors } from 'react-fengmap'
class Example extends Component {
render() {
const { selectedFloor } = this.props
return (
<FengmapFloors
fengmapSDK={fengmapSDK}
mapId="10347"
mapOptions={{
key: '你的key',
//开发者申请应用名称
appName: '你的应用',
defaultMapScaleLevel: 20,
defaultTiltAngle: 45
}}
value={selectedFloor}
style={{
width: '800px',
height: '550px'
}}
/>
)
}
}