Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开发模式下使用鼠标滚轮放大地图抛出 Uncaught TypeError: Cannot read properties of undefined (reading 'style') #329

Open
georgetian3 opened this issue Apr 25, 2024 · 0 comments

Comments

@georgetian3
Copy link

如何重现:

  1. 运行以下命令创建 React 项目并安装依赖:
npx create-react-app example --template typescript
cd example
npm i @uiw/react-baidu-map
  1. 将以下代码粘贴到 src/App.tsx
import './App.css';

import {
  Map, APILoader,
} from '@uiw/react-baidu-map';

const Demo = () => (
  <div style={{ width: '100%', height: '1000px', overflow: 'auto' }}>
    <APILoader akay="eYpCTECSntZmw0WyoQ7zFpCRR9cpgHFG">
      <Map
        zoom={13}
        style={{ height: 1000 }}
        enableScrollWheelZoom={true}
        enableContinuousZoom={true}
      >
      </Map>
    </APILoader>
  </div>
);


function App() {
  return <Demo></Demo>
}

export default App;
  1. 运行 npm start

当用户用鼠标滚轮放大地图会抛出 Uncaught TypeError: Cannot read properties of undefined (reading 'style') 并显示:

image

如果 npm run build 并用生产版本运行不会出现这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant