- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚在我现有的 vuejs 应用程序中添加了 typescript,我得到了一个 Object literal may only specify known properties, and 'router' does not exist in type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'
错误。我的理解是我不需要安装 @types/vue 或 @types/vue-router 来解决这个问题。
有人可以建议新手吗?
~\src\router.js
import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router);
const router = new Router({............
});
export default router;
ERROR in ~/src/main.ts(126,10):
126:10 No overload matches this call.
Overload 1 of 3, '(options?: ThisTypedComponentOptionsWithArrayProps<Vue, object, object, object, never> | undefined): CombinedVueInstance<Vue, object, object, object, Record<...>>', gave the following error.
Argument of type '{ router: any; store: any; i18n: any; acl: any; render: (h: CreateElement) => VNode; }' is not assignable to parameter of type 'ThisTypedComponentOptionsWithArrayProps<Vue, object, object, object, never>'.
Object literal may only specify known properties, and 'router' does not exist in type 'ThisTypedComponentOptionsWithArrayProps<Vue, object, object, object, never>'.
Overload 2 of 3, '(options?: ThisTypedComponentOptionsWithRecordProps<Vue, object, object, object, object> | undefined): CombinedVueInstance<Vue, object, object, object, Record<...>>', gave the following error.
Argument of type '{ router: any; store: any; i18n: any; acl: any; render: (h: CreateElement) => VNode; }' is not assignable to parameter of type 'ThisTypedComponentOptionsWithRecordProps<Vue, object, object, object, object>'.
Object literal may only specify known properties, and 'router' does not exist in type 'ThisTypedComponentOptionsWithRecordProps<Vue, object, object, object, object>'.
Overload 3 of 3, '(options?: ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>> | undefined): CombinedVueInstance<...>', gave the following error.
Argument of type '{ router: any; store: any; i18n: any; acl: any; render: (h: CreateElement) => VNode; }' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'.
Object literal may only specify known properties, and 'router' does not exist in type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'.
124 |
125 | Vue.config.productionTip = false;
> 126 | new Vue({router, store, i18n, acl, render: h => h(App)}).$mount('#app');
| ^
Version: typescript 3.8.3
{
"name": "video-audio-transcription",
"version": "4.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@aws-amplify/ui-vue": "^0.2.3",
"@chenfengyuan/vue-countdown": "^1.1.2",
"@react-native-community/netinfo": "^5.5.0",
"@syncfusion/ej2-vue-grids": "^18.1.46",
"@types/chart.js": "^2.9.20",
"@types/vue2-hammer": "^2.1.0",
"ag-grid-community": "^21.0.1",
"ag-grid-vue": "^21.0.1",
"algoliasearch": "^3.33.0",
"apexcharts": "^3.6.12",
"aws-amplify": "^3.0.9",
"axios": "^0.19.0",
"chart.js": "^2.8.0",
"core-js": "2.6.5",
"echarts": "^4.2.1",
"file-saver": "2.0.1",
"firebase": "^6.0.4",
"instantsearch.css": "^7.3.1",
"jsonwebtoken": "^8.5.1",
"material-icons": "^0.3.1",
"perfect-scrollbar": "^1.4.0",
"postcss-rtl": "^1.5.0",
"prismjs": "^1.16.0",
"vee-validate": "^2.2.8",
"vue": "^2.6.11",
"vue-acl": "4.0.7",
"vue-apexcharts": "^1.3.5",
"vue-awesome-swiper": "^3.1.3",
"vue-backtotop": "^1.6.1",
"vue-chartjs": "^3.4.2",
"vue-class-component": "^7.2.3",
"vue-clipboard2": "^0.3.0",
"vue-context": "4.0.0",
"vue-echarts": "^4.0.3",
"vue-feather-icons": "^5.0.0",
"vue-flatpickr-component": "^8.1.2",
"vue-form-wizard": "^0.8.4",
"vue-fullcalendar": "^1.0.9",
"vue-i18n": "^8.11.2",
"vue-instantsearch": "^2.2.1",
"vue-perfect-scrollbar": "^0.1.0",
"vue-prism-component": "^1.1.1",
"vue-property-decorator": "^8.4.1",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.6",
"vue-select": "^3.1.0",
"vue-simple-calendar": "^4.2.2",
"vue-simple-suggest": "^1.9.5",
"vue-star-rating": "^1.6.1",
"vue-tour": "^1.1.0",
"vue-tree-halower": "^1.8.0",
"vue-video-player": "^5.0.2",
"vue2-google-maps": "^0.10.6",
"vue2-hammer": "^2.1.2",
"vuedraggable": "^2.21.0",
"vuejs-datepicker": "^1.5.4",
"vuesax": "3.11.1",
"vuex": "^3.1.1",
"xlsx": "^0.15.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^1.2.0",
"@types/jest": "^24.0.19",
"@vue/cli-plugin-babel": "^3.7.0",
"@vue/cli-plugin-typescript": "^4.3.1",
"@vue/cli-plugin-unit-jest": "^4.3.1",
"@vue/cli-service": "^3.7.0",
"@vue/test-utils": "^1.0.0-beta.31",
"axios-mock-adapter": "^1.17.0",
"jest-localstorage-mock": "^2.4.2",
"node-sass": "^4.12.0",
"purgecss": "^1.3.0",
"sass-loader": "^7.1.0",
"script-loader": "0.7.2",
"tailwindcss": "^1.0.1",
"typescript": "^3.5.2",
"vue-template-compiler": "^2.6.10"
},
"jest": {
"setupFiles": [
"jest-localstorage-mock"
],
"preset": "@vue/cli-plugin-unit-jest/presets/typescript-and-babel"
}
}
最佳答案
只需添加 "types": []
您的 中的数组tsconfig.js 带有 Vue 的下载类型的路径, VueRouter等。
就我而言,它看起来像这样:
...
"types": [
"./types/vue/",
"./types/vue-router/"
],
...
关于javascript - typescript 错误 : Object literal may only specify known properties, 和 'router' 在“ComponentOptions<Vue”类型中不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61648568/
在 CSS 中,我从来没有真正理解为什么会发生这种情况,但每当我为某物分配 margin-top:50% 时,该元素就会被推到页面底部,几乎完全消失这一页。我假设 50% 时,该元素将位于页面的中间位
我想在 MongoDB 中使用 Grails2.5 中的“ElasticSearch”插件。我的“BuildConfig.groovy”文件是: grails.servlet.version = "3
我有一个我想要处理的 OHLC 股票报价数组。 Open High Low Close Volume 2003-01-05
我尝试创建一个PreparedStatement: stmt = conn.prepareStatement("SELECT POLBRP, POLTYP, POLNOP, INCPTP, TRMTH
我的目录结构如下: root libA CMakeLists.txt ClassA.cpp libB CMakeLists.txt ClassB.cpp s
我是 DBMS 的新手。我在每个用户的不同 csv 文件中都有车辆痕迹。格式:名称,时间戳,纬度,经度,randomId。例如:user0,2008-10-2309:42:25,441972.6942
我需要为我的应用程序打上烙印,并且只需要自定义少量图像,代码库是相同的,只是生成的常量很少。 由于aapt 允许指定许多资源目录,有没有办法在Eclipse .classpath 文件中指定res 目
我希望在我的应用程序中实现 JWT,因为我正在通过引用以下内容对其进行一些研发:https://stormpath.com/blog/jwt-java-create-verify .当我尝试通过提取声
我正在尝试通过设置限制获取数据并根据时间戳对数据进行排序,但在运行应用程序时崩溃并显示此错误消息: 查询无效。在指定顺序之前不得指定起点。 我不知道为什么会这样。如何解决? 我需要数据序列和排序。
我正在使用Elasticsearch和Tire进行Rails3项目。当我尝试运行Elastic-search时,安装它后,出现以下错误: The stack size specified is too
我创建了一个简单的函数来执行 Http PUT 请求 - public string checkIfUserExists(string userName) { var endP
Java 安全管理器允许通过定义如下子句来指定某些代码段的权限: ... grant codebase http://foo.bar.com/test.jar { permission java
这更像是一种验证。 在 Oracle/Java 教程页面上,例如 this , 我一直看到catch 旁边的“specify”就好像它是另一个语句在异常处理中具有一些功能。 据我所知,“catch o
本文整理了Java中org.batfish.specifier.ZoneNameRegexInterfaceSpecifier类的一些代码示例,展示了ZoneNameRegexInterfaceSpe
我正在尝试运行以下命令: ionic cordova run android --device 但我收到以下错误 BUILD FAILED in 3s (node:3956) Unha
在不包含 viewport 元标记的网页上,大多数移动浏览器会将页面上的部分或全部字体“提升”到大于 css 指定的大小。例如,在移动版 Safari 上,7px 的指定大小将提升为类似 12px 的
嗨,我不了解 keras fit_generator 文档。 我希望我的困惑是理性的。 有一个batch_size还有分批训练的概念。使用 model_fit() ,我指定一个 batch_size
我使用 IProviderSearchContext 在 Sitecore 8.1(Lucene 搜索)中搜索特定项目,并获得每个项目的两个版本(en、ar)。我的问题是:我是否必须为每个查询指定:
Except in a declaration of a constructor, destructor, or conversion function, at least one defining-
使用 GooglePageSpeed 分析在线商店(Shopware)导致每个图像上出现许多“未指定到期时间”的线条。 我想知道是因为网络服务器 (nginx) 在所有图像的响应中添加了 Last-M
我是一名优秀的程序员,十分优秀!