Popup - react-map-gl

文章推薦指數: 80 %
投票人數:10人

A string indicating the part of the popup that should be positioned closest to the coordinate, set via longitude and latitude . If unset, the anchor will be ... ChevronDownIntroductionIntroductionWhat'snewUpgradeGuideContributingtoreact-map-glChevronDownDeveloperGuideGetStartedAboutMapboxTokensStateManagementAddingCustomDataTipsandTricksChevronDownAPIReferencedefault(Map)AttributionControlFullscreenControlGeolocateControlLayerMapProviderMarkerNavigationControlPopupScaleControlSourceuseControluseMapTypesPopupPropertiesReactcomponentthatwrapsPopup.import*asReactfrom'react'; importMap,{Popup}from'react-map-gl'; functionApp(){ const[showPopup,setShowPopup]=React.useState(true); return {showPopup&&( setShowPopup(false)}> Youarehere )} ; }Renderoptionsanchor:'center'|'left'|'right'|'top'|'bottom'|'top-left'|'top-right'|'bottom-left'|'bottom-right'|undefinedAstringindicatingthepartofthepopupthatshouldbepositionedclosesttothecoordinate,setvialongitudeandlatitude. Ifunset,theanchorwillbedynamicallysettoensurethepopupfallswithinthemapcontainerwithapreferencefor'bottom'.className:stringSpace-separatedCSSclassnamestoaddtopopupcontainer.closeButton:booleanDefault:trueIftrue,aclosebuttonwillappearinthetoprightcornerofthepopup.closeOnClick:booleanDefault:trueIftrue,thepopupwillclosewhenthemapisclicked.closeOnMove:booleanDefault:falseIftrue,thepopupwillclosedwhenthemapmoves.focusAfterOpen:booleanDefault:trueIftrue,thepopupwilltrytofocusthefirstfocusableelementinsidethepopup.offset:number|PointLike|Record\Default:nullApixeloffsetappliedtothepopup'slocationspecifiedas:asinglenumberspecifyingadistancefromthepopup'slocationaPointLikespecifyingaconstantoffsetanobjectofPointsspecifinganoffsetforeachanchorposition.Negativeoffsetsindicateleftandup.maxWidth:stringDefault:240pxAstringthatsetstheCSSpropertyofthepopup'smaximumwidth.style:CSSPropertiesCSSstyleoverridethatappliestothepopup'scontainer.CallbacksonOpen:(evt:PopupEvent)=>voidCalledwhenthepopupisopened.onClose:(evt:PopupEvent)=>voidCalledwhenthepopupisclosedbytheuserclickingontheclosebuttonoroutside(ifcloseOnClick:true).Sourcepopup.ts



請為這篇文章評分?