[英]Can't import vue2-google-maps component to main.js
After installing vue2-google-maps with npm, I'm trying to import the component to my main.js.在使用 npm 安装 vue2-google-maps 后,我正在尝试将组件导入我的 main.js。 But I keep getting an error.
但我不断收到错误消息。 I never had problem importing packages to main.js or to other.vue files.
我从来没有遇到过将包导入 main.js 或 other.vue 文件的问题。
Versions: vue 2.6.10 vue2-google-maps@0.10.7 vue-cli 2.9.6 but also tried with 3.11.0版本: vue 2.6.10 vue2-google-maps@0.10.7 vue-cli 2.9.6 但也尝试使用 3.11.0
import App from "./App.vue";
import store from "./store/store.js";
import * as VueGoogleMaps from "vue2-google-maps";
Vue.use(
VueGoogleMaps,
{
load: {
key: "AIzaSyBYULuuIqKYMJVrEk1PjpUDQQYkGMmP0iM",
libraries: 'places'
}
}
);
I'm getting the error in this line: import * as VueGoogleMaps from "vue2-google-maps";我在这一行中遇到错误: import * as VueGoogleMaps from "vue2-google-maps";
Error Message: Could not find a declaration file for module 'vue2-google-maps'.
错误消息:找不到模块“vue2-google-maps”的声明文件。 'c:/Users/BotiVegh/vueJS_projects/vue-store-gallery-map/node_modules/vue2-google-maps/dist/main.js' implicitly has an 'any' type.
'c:/Users/BotiVegh/vueJS_projects/vue-store-gallery-map/node_modules/vue2-google-maps/dist/main.js' 隐含了一个 'any' 类型。 Try
npm install @types/vue2-google-maps
if it exists or add a new declaration (.d.ts) file containingdeclare module 'vue2-google-maps';
如果存在,请尝试
npm install @types/vue2-google-maps
或添加包含declare module 'vue2-google-maps';
ts(7016)ts(7016)
Do I need to change something in the config file?我需要更改配置文件中的某些内容吗?
You could try adding "noImplicitAny": false
to your tsconfig.json file您可以尝试在tsconfig.json文件中添加
"noImplicitAny": false
This disables warnings on expressions and declarations with an implied 'any' type这将禁用对具有隐含“任何”类型的表达式和声明的警告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.