我有一个Vue/TypeScript类,它调用另一个Vue/TypeScript类上的公共方法。它可以编译并在tsc或WebPack上运行良好。但是当使用rollup和rollup-plugin-vue进行编译时,我得到一个错误,即Property 'close' does not exist on type 'Vue'. 转载链接:https://repl.it/@orobert91/PropertyDoesNotExistOnTypeVue Popover.vue: import { Component } from "vue-property-d
<script>
import * as Vue from 'vue'
import Component from 'vue-class-component'
@Component
export default class HelloWorld extends Vue {
//my operation
}
</script>
这是“vue类组件”的一个简单示例。但是,当我运行项目时,浏览器会显示这样的错误信息:
Uncaught TypeError: Class extends value #<Object> is
当我运行包含某些Vuetify组件的vue run test:unit时,我得到了以下错误:
ReferenceError: requestAnimationFrame is not defined
at VueComponent.mounted (dist/js/webpack:/src/components/VTextField/VTextField.ts:229:1)
at invokeWithErrorHandling (dist/js/webpack:/node_modules/vue/dist/vue.runtime.esm.js:1854:1)
我使用cli v4.4.1安装vue。
之后,我运行此命令以更新为Vue3:vue add vue-next。
当我打开main.ts时,我得到了typescript错误:
Argument of type 'typeof import("c:/../vue-app/node_modules/vue/dist/vue")' is not assignable to parameter of type 'PublicAPIComponent'.
我需要做些什么来解决这个错误?
我们使用vuejs,typescript,vuex和jest。我们目前正在使用test-utils来模拟商店。
但我找不到如何模拟对此的调用.$parent.$on
这是我们的一个组件(非常简单):
AnalysisList.ts:
import Component from 'vue-class-component'
import {Getter} from 'vuex-class'
import {UserVO} from '@/valueObjects/UserVO'
import {Vue} from 'vue-property-
我试着改编,但是遇到了第一个障碍。Property 'created' does not exist on type 'VueConstructor<Vue>'。
下面是我的测试,只是为了验证我的组件确实有一个created钩子:
import {assert} from 'chai';
import MyComponent from '../src/components/MyComponent.vue';
it('has a created hook', function() {
asser
在我们的纱线多工作区项目中,我们得到了一个非常奇怪的类型记录构建异常,最新版本的vue:
TS2345: Argument of type 'Router' is not assignable to parameter of type 'Plugin_2'.
Type 'Router' is not assignable to type '{ install: PluginInstallFunction; }'.
Types of property 'install' are incompatible.
嗨,我正在使用Vue 3和Typescript和Class组件。我只是从文档中复制粘贴了示例,但看起来Typescript有问题: TS1238: Unable to resolve signature of class decorator when called as an expression.
This expression is not callable.
Type 'typeof import(".../node_modules/vue-class-component/dist/vue-class-component")' has no
这是一个简化的例子。我有一个使用装饰器的类定义,比如: export default class AnimationController {
@observable animationTime: number = 0;
@computed({keepAlive: true}) get interpolatedJoints(){}
@computed({keepAlive: true}) get currentAnimation(){}
} 在其他地方,我正在导入这个类作为类型定义,并且在访问这些预期的属性时遇到错误。 import AnimationController from
如果文件是在库中导入的,我会看到这个错误,但是如果您在项目中使用相同的脚本,那么一切都正常。我已经尝试过maxNodeModuleJsDepth = 1,但这不起作用。
错误文本:
Uncaught Error: Module parse failed: Unexpected token (5:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/co
我使用nklayman/vue-cli-plugin-electron-builder创建了一个用Vue/Vuex编写的电子应用程序。它附带了main.js,background.js文件,包括Vue组件的起点。但是我不能让事件工作。我在下面的尝试在渲染时产生了Uncaught ReferenceError: __dirname is not defined (编译就可以了)。 组件: Splash.vue <template>
<div @click="open">open</div>
</template>
我正在尝试用Vite发布一个Vue 3组件库。我已经用打字机写好了。然而,我遇到了一个问题,我的类型定义没有被带到包中。 在另一个项目中导入构件时,我看到以下问题: Try `npm i --save-dev @types/repo__mypackagename` if it exists or add a new declaration (.d.ts) file containing `declare module '@repo/mypackagename'; 我知道我需要提供一个声明文件,但我想知道如何具体使用Vite & Vue 3实现这一点…… 我的packa
--我得到了这个跟踪,在从github中提取新代码之前,我不会得到这个错误,但是我无法检测哪个模块没有导入
* ./assets in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/JobDetailPrint.vue?vue&type
在一个TypeScript项目中,我尝试导入一个与WebPack捆绑在一起的名为"fsaa-util“的TypeScript库。代码编译fines,但在运行时,当尝试使用该库中的对象时,fines是未定义的。
index.ts:
import { MyClass } from "fsaa-util";
let t = new MyClass(); //Throws MyClass is not a constructor.
console.log(t);
库的index.ts:
import "reflect-metadata";
export {
在运行使用Nuxt.js开发的Nuxt.js时,我遇到了一个非常奇怪的错误,它有Vue.js组件。也就是说,在运行应用程序时,我看到了与TypeScript相关的错误,比如TS2749: 'About' refers to a value, but is being used as a type here. Did you mean 'typeof About'?,尽管npm run test没有显示任何内容。
我的带有抱怨行的spec.ts文件
import { shallowMount, Wrapper } from "@vue/test-utils
我有一个使用scss组件的vue应用程序。我已经安装了sass-加载程序,所有这些都很好--除非我尝试导入引导scss文件。
这就是失败的特定导入:
<style lang="scss">
@import url("~bootstrap/scss/mixins");
...
我收到以下错误:
This dependency was not found:
* -!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/l
我尝试使用vue-injector,但它使用我的Vue (2.6.10)和Typescript (3.4.5)版本编译。 我几乎看不到其他选择。 在纯粹的typescript方面,我看到了像Inversify和TSyringe这样的东西,它们看起来很好,但不能开箱即用。 这是inversify: Argument of type typeof App' is not assignable to parameter of type 'VueClass<Vue>'.
Type 'typeof App' is not assignab
我在TypeScript中使用Jest 27.5.1。当我尝试测试时,我得到了以下错误:
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'extend')
2 | <div>Hello</div>
3 | </template&g
首先,让我提供一个到git存储库的链接:https://github.com/kbottner/vue3ts 从启用了TypeScript的vue-cli创建的非常简单的Vue3项目。如果您检查提交,您将看到一个简单的更改(添加一个ts文件以包含在vue文件中)导致项目不再起作用。 如果我执行npm run build 我收到以下输出: This relative module was not found:
* ../composables/test.js in ./node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_module
我有一个模态组件,需要状态、路由器、道具和语言混合器来渲染,这就是道具的样子。
import moment from "moment-timezone"
import { faTimes } from "@fortawesome/pro-solid-svg-icons/faTimes"
import { faExclamation } from "@fortawesome/pro-solid-svg-icons/faExclamation"
import { faChevronRight } from "@fortawesome/pro-