Answer the question
In order to leave comments, you need to log in
Why is ymaps.ready() not working?
hello script.
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey="some_api_key"></script>
...
mounted() {
ymaps.ready({
successCallback: () => {
this.yaMapInit()
}
})
},
...
methods: {
...
yaMapInit() {
let id = this.forId
try {
this.SuggestView = new ymaps.SuggestView(id, {
provider: { suggest: (...args) => this.suggest(...args) },
boundedBy: this.bounds[this.brandCode],
container: document.getElementById(id + '-container'),
results: 50
})
this.SuggestView.events.add('select', e => {
this.geoValue = JSON.parse(e.get('item').jsonData).city
localStorage.setItem('location.city', JSON.parse(e.get('item').jsonData).city)
})
console.log('yamaps init')
} catch (e) {
console.log(`yamaps init error: ${e}`)
}
},
...
}
ymaps.SuggestView is not constructor
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question