diff --git a/docs/en/guide/README.md b/docs/en/guide/README.md index 072f5d7..c4b2ef6 100644 --- a/docs/en/guide/README.md +++ b/docs/en/guide/README.md @@ -28,6 +28,7 @@ These settings are optional and below you can see default options: ```JavaScript const settings = { apiKey: '', + suggestApiKey: '', lang: 'ru_RU', coordorder: 'latlong', enterprise: false, diff --git a/docs/guide/README.md b/docs/guide/README.md index ab1e705..adc4d23 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -22,6 +22,7 @@ npm install vue-yandex-maps ```JavaScript const settings = { apiKey: '', + suggestApiKey: '', lang: 'ru_RU', coordorder: 'latlong', enterprise: false, diff --git a/src/utils.js b/src/utils.js index 30d1f75..80b6e4f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -215,6 +215,7 @@ export function ymapLoader(settings = {}) { const yandexMapScript = document.createElement('SCRIPT'); const { apiKey = '', + suggestApiKey = '', lang = 'ru_RU', version = '2.1', coordorder = 'latlong', @@ -222,7 +223,8 @@ export function ymapLoader(settings = {}) { enterprise = false, } = settings; const mode = debug ? 'debug' : 'release'; - const settingsPart = `lang=${lang}${apiKey && `&apikey=${apiKey}`}&mode=${mode}&coordorder=${coordorder}`; + let settingsPart = `lang=${lang}${apiKey && `&apikey=${apiKey}`}&mode=${mode}&coordorder=${coordorder}`; + if (suggestApiKey) settingsPart += `&suggest_apikey=${suggestApiKey}`; const link = `https://${enterprise ? 'enterprise.' : ''}api-maps.yandex.ru/${version}/?${settingsPart}`; yandexMapScript.setAttribute('src', link); yandexMapScript.setAttribute('async', '');