我已经用枚举和接口制作了一个ts文件,并且需要在Vue组件中使用它们。但是,当我尝试将ts文件导入Vue组件时,出现一条错误消息,提示它找不到模块。
我的src / models / Profile.ts文件如下:
export enum Status {
NONE,
ACCEPTING,
NOT_ACCEPTING,
}
export interface Profile {
status: Status,
firstName: string,
lastName: string,
}
我要导入上述内容的Vue组件:
import Profile from '@/models/Profile.ts';
@Component({computed: mapGetters(['user'])})
export default class CreateProfile extends Vue {
...
}
特定错误:
An import path cannot end with a '.ts' extension. Consider importing '@/models/Profile' instead.
但是当我尝试这样做时,我得到了:
Cannot find module '@/models/Profile'.