我正在尝试使用vue-form-wizard
Vue 组件,使用由vue-class-component
.
这是我的.vue
文件:
<template>
<form-wizard>
<tab-content title="Personal details">
My first tab content
</tab-content>
<tab-content title="Additional Info">
My second tab content
</tab-content>
<tab-content title="Last step">
Yuhuuu! This seems pretty damn simple
</tab-content>
</form-wizard>
</template>
<script lang="ts">
import Vue from 'vue';
import Component from "vue-class-component";
import { FormWizard, TabContent} from "vue-form-wizard";
@Component({
components: {
FormWizard, TabContent
}
})
export default class AdvisorWizard extends Vue {
}
</script>
这是 TypeScript 生成的错误:
Argument of type '{ components: { FormWizard: typeof FormWizard; TabContent: typeof TabContent; }; }' is not assignable to parameter of type 'VueClass<Vue>'. Object literal may only specify known properties, but 'components' does not exist in type 'VueClass<Vue>'. Did you mean to write 'component'?
我很确定这是因为FormWizard
没有扩展或以其他方式实现 Vue。但我不知道如何强制转换组件或以其他方式强制 TypeScript 相信这FormWizard
是一个 Vue 组件。
是否有可能FormWizard
只是错误的类型?
export type ShapeType = 'circle' | 'square' | 'tab'
export type LayoutType = 'vertical' | 'horizontal'
export type StepSizeType = 'xs' | 'sm' | 'md' | 'lg'
export declare class Wizard {
/** Wizard title */
title: string
/** Wizard subtitle */
subtitle: string
nextButtonText: string
backButtonText: string
finishButtonText: string
/** Whether to hide footer buttons */
hideButtons: boolean
/** Whether to trigger beforeChange function when navigating back */
validateOnBack: boolean
/** Active step and button color */
color: string
/** Step color when the current step is not valid */
errorColor: string
/** Main step shape */
shape: ShapeType
/** Wizard layout */
layout: LayoutType
/** Additional css classes for steps */
stepsClasses: string[]
/** Step size */
stepSize: StepSizeType
/** Step transition from inactive to active */
transition: string
/** Tab index where the wizard should start */
startIndex: number
}
如果是这样,我该怎么做才能解决它?