اعلامیه: سبک نقشه پایه جدید به زودی به پلتفرم نقشه های گوگل می آید. این بهروزرسانی برای استایل نقشه شامل یک پالت رنگی پیشفرض جدید، پینهای مدرن شده و بهبودهایی در تجربهها و قابلیت استفاده از نقشه است. همه سبکهای نقشه بهطور خودکار در مارس 2025 بهروزرسانی میشوند. برای اطلاعات بیشتر در مورد در دسترس بودن و نحوه انتخاب زودتر، به سبک نقشه جدید برای پلتفرم Google Maps مراجعه کنید.
برای بارگیری کتابخانههایی که از Places UI Kit پشتیبانی میکنند، ابتدا Maps JavaScript API را با افزودن بارگذار بوت استرپ درون خطی به کد برنامه خود بارگیری کنید، همانطور که در قطعه زیر نشان داده شده است:
<script>
(g=>{varh,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});vard=b.maps||(b.maps={}),r=newSet,e=newURLSearchParams,u=()=>h||(h=newPromise(async(f,n)=>{await(a=m.createElement("script"));e.set("libraries",[...r]+"");for(king)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({key:"YOUR_API_KEY",v:"alpha",// Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).// Add other bootstrap parameters as needed, using camel case.});</script>
در مرحله بعد، از عملگر await برای فراخوانی importLibrary() از داخل یک تابع async ، به صورت زیر استفاده کنید:
// Import the Places Library for PlaceDetailsElement and PlaceListElementconst{PlaceDetailsElement,PlaceListElement}=awaitgoogle.maps.importLibrary('places');// Import the Elevation Library for ElevationElementconst{ElevationElement}=awaitgoogle.maps.importLibrary('elevation');
تاریخ آخرین بهروزرسانی 2025-01-28 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-01-28 بهوقت ساعت هماهنگ جهانی."],[[["To use the Places UI Kit, you must create a Cloud project, enable the Places UI Kit, and obtain an API key."],["The Maps JavaScript API needs to be loaded using the inline bootstrap loader, including your API key and desired version."],["Utilize the `importLibrary()` function to load specific libraries like `places` and `elevation` for using elements like `PlaceDetailsElement`, `PlaceListElement`, and `ElevationElement`."]]],["To use the Places UI Kit, first create a Cloud project with billing and enable the Places UI Kit. Obtain an API key for access. Load supporting libraries by adding the Maps JavaScript API's inline bootstrap loader to your code. Utilize the `importLibrary()` function within an `async` function to import libraries like 'places' and 'elevation', then you can use the `PlaceDetailsElement`, `PlaceListElement`, and `ElevationElement`.\n"]]