导入"marker-animate-unobtrusive"时,Vue导入失败 [英] Vue import fails when importing 'marker-animate-unobtrusive'

查看:96
本文介绍了导入"marker-animate-unobtrusive"时,Vue导入失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个小型Vue项目,并且正在使用 marker-animate-unobtrusive 库可在地图上移动标记.这里的问题是,当我在自己的页面之一中导入该库时,将不会加载整个应用程序.例如,当我在不导入库的情况下启动我的开发服务器时,它从"localhost:port/#/login"开始,但是在导入时,它从"localhost:port"开始,并且仅显示一个空白屏幕.

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.

我尝试使用

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

代替

import SlidingMarker from 'marker-animate-unobtrusive'

但是它不能解决我的问题.

but it doesn't fix my issue.

SC

推荐答案

显然,该库要求google在初始化后可用于window对象,但尚不存在.
google-maps脚本之前,库可能已导入(包含)在您的项目中. 尝试更改导入顺序.确保在google-maps脚本之后加载了marker-animate-unobtrusive.

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.

这篇关于导入"marker-animate-unobtrusive"时,Vue导入失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆