小编Ger*_*sya的帖子

如何在 google-maps-react 中添加标记 onClick 并显示我的地理位置?

我在 google maps 文档中找到了很多有用的信息,但是在 html 中简单地使用了 js,react老实说我不明白。

源代码:

import React, { Component } from 'react';
import {Map, InfoWindow, Marker, GoogleApiWrapper} from 'google-maps-react';

export class MainMap extends Component {
    render() {
        return (
            <div>
                <h1 className="text-center">My Maps</h1>
            <Map google={this.props.google}
                 style={{width: '80%', margin: 'auto'}}
                 className={'map'}
                 zoom={14}>
                <Marker
                    title={'The marker`s title will appear as a tooltip.'}
                    name={'SOMA'}
                    position={{lat: 37.778519, lng: -122.405640}} />
                <Marker
                    name={'Dolores park'}
                    position={{lat: 37.759703, lng: -122.428093}} />
                <Marker />
                <Marker
                    name={'Your position'}
                    position={{lat: 46.475640, lng: 30.759497}}/>
            </Map>
            </div> …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps reactjs react-google-maps

6
推荐指数
1
解决办法
8842
查看次数

未捕获的TypeError:无法设置null的属性'onclick',无法打开我的弹出窗口

我正在使用反应,我试图简单地显示我的弹出窗口,但我有这个错误

Uncaught TypeError: Cannot set property 'onclick' of null
    at eval (index.js:33)
    at Object../src/index.js (main.js:680)
    at __webpack_require__ (main.js:20)
    at eval (index.js:9)
    at Object../examples/src/index.js (main.js:97)
    at __webpack_require__ (main.js:20)
    at eval (webpack:///multi_(:3001/webpack)-dev-server/client?:2:18)
    at Object.0 (main.js:702)
    at __webpack_require__ (main.js:20)
    at main.js:84
Run Code Online (Sandbox Code Playgroud)

这是我的完整index.js

import React from 'react';
import './style.scss';
import ReactDOM from "react-dom";

const modal = document.getElementById('myModal');

const btn = document.getElementById("myBtn");

const span = document.getElementsByClassName("close")[0];

btn.onclick = function() {
    modal.style.display = "block";
};

span.onclick = function() {
    modal.style.display = "none";
};

window.onclick = function(event) …
Run Code Online (Sandbox Code Playgroud)

javascript popup reactjs react-native

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

如何使用MS SQL按逗号分隔列

这是我的代码

select top 100
       ih.streetname,
       ih.district,
       ih.intervalhouse
from vw_pn_intervalshouse ih
inner join vw_pn_street s on s.id = ih.streetname
CROSS APPLY STRING_SPLIT(ih.intervalhouse, ',');
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用string_split,但结果不正确

我会告诉你一些输出

district        streetname      intervalhouse
32000100001832  1008302496093   1,17
32000100001832  1008302496093   1,17
32000100001832  1008302496095   8,10,12
32000100001832  1008302496095   8,10,12
32000100001832  1008302496095   8,10,12
Run Code Online (Sandbox Code Playgroud)

结果一定像

district        streetname      intervalhouse
32000100001832  1008302496093   1
32000100001832  1008302496093   17
32000100001832  1008302496095   8
32000100001832  1008302496095   10
32000100001832  1008302496095   12
Run Code Online (Sandbox Code Playgroud)

可能是什么问题呢?有什么解决办法吗?

sql sql-server split

0
推荐指数
1
解决办法
49
查看次数