Vue import fails when importing 'marker-animat

2019-08-05 15:22发布

I'm working on a small vue project and I'm using marker-animate-unobtrusive library to move markers over the map. The issue here is that when I import this library in one of my pages, the whole app won't load. for example, when I start my dev server without importing the library it starts at "localhost:port/#/login", but when I import it, it starts at "localhost:port" and only shows an empty screen.

I've tried using

var SlidingMarker = require('marker-animate-unobtrusive');

Instead of

import SlidingMarker from 'marker-animate-unobtrusive'

but it doesn't fix my issue.

edit:

SC from browser console enter image description here

1条回答
Deceive 欺骗
2楼-- · 2019-08-05 15:35

Apparently, this library requires google to be available on window object upon initialization, but it is not there yet. It is possible, that library is imported (included) in your project before google-maps script.
Try changing the order of imports. Make sure that marker-animate-unobtrusive is loaded after google-maps script.

查看更多
登录 后发表回答