我目前正在構(gòu)建一個 React 應(yīng)用程序,其中包含一個使用React Simple Maps構(gòu)建的交互式 SVG 地圖。在我的桌面瀏覽器中,一切都按預(yù)期工作,但是地圖本身不會加載到移動設(shè)備上(我已經(jīng)測試了幾個)而且我不明白為什么。我在下面包含了相關(guān)組件的代碼(我刪除了代碼中一些不相關(guān)的部分):import React, { memo, Component } from 'react';import { ZoomableGroup, ComposableMap, Geographies, Geography } from "react-simple-maps";import geoUrl from "../data/topo.json";import Country from './Country'import { CSSTransition, SwitchTransition } from "react-transition-group";class Map extends Component {?? ? constructor(props){? ? ? ? super(props);? ? ? ? this.state = {? ? ? ? ? ? country: "",? ? ? ? ? ? dish: "",? ? ? ? ? ? description: "",? ? ? ? ? ? photo: "",? ? ? ? ? ? recipe: "",? ? ? ? ? ? selected: false,? ? ? ? }? ? ? ? this.handleBack = this.handleBack.bind(this);? ? ? ? this.handleAbout = this.handleAbout.bind(this);? ? ? ? this.handleList = this.handleList.bind(this);? ? }? ? handleEnter(country, dish, description, photo, recipe){? ? ? ? this.setState({? ? ? ? ? ? country: country,? ? ? ? ? ? dish: dish,? ? ? ? ? ? description: description,? ? ? ? ? ? photo: photo,? ? ? ? ? ? recipe: recipe? ? ? ? })? ? }? ??? ? render(){?? ??? ? ? ? const { country, dish, description, photo, recipe, selected } = this.state;? ? ? ? const countries = geoUrl.objects.ne_50m_admin_0_countries.geometries;? ? ? ? return(? ? ? ? ? ? <SwitchTransition>? ? ? ? ? ? ? ? <CSSTransition? ? ? ? ? ? ? ? ? ? classNames="transition"? ? ? ? ? ? ? ? ? ? transitionAppearTimeout={50000}? ? ? ? ? ? ? ? ? ? key={ selected }? ? ? ? ? ? ? ? ? ? in={ selected }? ? ? ? ? ? ? ? ? ? unmountOnExit? ? ? ? ? ? ? ? ? ? appear? ? ? ? ? ? ? ? >? ? ? ? ?? ? ? ? ? ? ? ? ? ? <>?如果有人可能有任何見解,那將是太棒了!如果您想查看更多代碼/屏幕截圖等,請告訴我。謝謝!javascript反應(yīng)反應(yīng)本機(jī)svg地圖
SVG(使用 React Simple Maps)不顯示在移動設(shè)備上
墨色風(fēng)雨
2023-05-25 16:40:21