2017-05-22 74 views

回答

1

我最近使用React RefsLeaflet API解決了這個問題。

甲準系統例如:

import React, { Component } from 'react'; 

import { Circle } from 'react-leaflet'; 

class Foo extends Component { 
    render() { 
     const { center, radius } = this.props; 
     return (
      <Circle 
       ref={circle => { this.circle = circle; }} 
       center={center} 
       radius={radius} 
       onMouseOver={() => { 
        this.circle.leafletElement.bindPopup('foo').openPopup(); 
       }}/> 
     ); 
    } 
} 

export default Foo;