小编A. *_*sen的帖子

使用 React Google Maps 显示方向

我是 React 的新手,正在尝试使用谷歌地图来显示方向。我已经能够让它显示单个标记,但还没有找到如何重新配置​​代码以显示方向。以下是我最近的尝试,但它只会显示地图......感谢任何帮助:

import React, { Component } from 'react';
import { withGoogleMap, GoogleMap, DirectionsRenderer } from 'react-google-maps';
class Map extends Component {
   render() {
   const GoogleMapExample = withGoogleMap(props => (
      <GoogleMap
        defaultCenter = { { lat: 40.756795, lng: -73.954298 } }
        defaultZoom = { 13 }
      >

<DirectionsRenderer origin={{ lat: 40.756795, lng: -73.954298 }} destination={{ lat: 41.756795, lng: -78.954298 }} />
      </GoogleMap>
   ));
   return(
      <div>
        <GoogleMapExample
          containerElement={ <div style={{ height: `500px`, width: '500px' }} /> }
          mapElement={ <div style={{ …
Run Code Online (Sandbox Code Playgroud)

google-maps reactjs react-google-maps

4
推荐指数
1
解决办法
2万
查看次数

未捕获的类型错误:无法在字符串 ' 上创建属性 'guid'

我试图运行下面的 jQuery .on() 方法,参数值为 10 但是每当我这样做时,我都会得到一个

未捕获的类型错误

 $(document).on("click", '.topic-btn', displayGIF(10));
Run Code Online (Sandbox Code Playgroud)

我的理解是它的编写方式运行该函数而不会导致错误的单击事件。

有没有解决的办法?最终,我希望.on("click"...参数值为10.on("dblcick"...参数值为20

javascript jquery guid typeerror

2
推荐指数
1
解决办法
2万
查看次数