How to create a route between points using the vue-yandex-maps plugin in vue 3?

35 views Asked by At

I'm trying to create a route like this:

I have an array of points on a map, let's say: [['55.7961', '37.7048'], ['55.8337', '37.7644'], ['55.8337', '37.7634']]

I need to build a route between them. The plugin gives me access to the global ymaps instance, which I try to use like this:

const points = [['55.7961', '37.7048'], ['55.8337', '37.7644'], ['55.8337', '37.7634']]
const multiRoute = new window.ymaps.multiRouter.MultiRoute(
            {
                referencePoints: points,
            },
            {
                boundsAutoApply: true
            }
        );

window.ymaps.geoObjects.add(multiRoute); // ???????????????

And on the last line I have a misunderstanding - there are no geoObjects in the global instance, so I don’t understand what to do next. And I think that the use of the new window.ymaps construct is also inadequate here.

How to do everything correctly using vue-yandex-maps?

0

There are 0 answers