首页 > 其他分享 >vue中ts引入组件,无法找到模块xxx的声明文件。xxx隐式拥有 "any" 类型。

vue中ts引入组件,无法找到模块xxx的声明文件。xxx隐式拥有 "any" 类型。

时间:2024-04-20 23:33:52浏览次数:44  
标签:文件 vue xxx ts 类型 声明

原因说明

  简单来说就是ts不认识.vue这个类型,需要定义声明。我刚学ts不是很懂为什么vite官方内写了那么多类型声明就是不写.vue。

解决方法

在项目根目录下找到env.d.ts文件,这个文件定义类型声明,简单地说就是让ts认识各种类型,尤其是文件。那么解决方法显而易见,我们自定义vue的类型声明加入到env.d.ts文件末尾即可。

declare module '*.vue' {
    import { ComponentOptions } from 'vue'
    const componentOptions: ComponentOptions
    export default componentOptions
}

标签:文件,vue,xxx,ts,类型,声明
From: https://www.cnblogs.com/oldsaltfish/p/18148411

相关文章

  • ASP.NET MVC4.0+EF+LINQ+bui+bootstrap+网站+角色权限管理系统(1)
    ASP.NETMVC4.0+EF+LINQ+bui+bootstrap+网站+角色权限管理系统(1) 本系列的的角色权限管理主要采用Dotnet MVC4工程内置的权限管理模块Simplemembership实现,主要有关文件是InitializeSimpleMembershipAttribute.cs和AccountModels.cs下面是对这两个文件的了解和改造 WebSe......
  • Computer Basics 03 - Basic Parts of a Computer
     IntroductionThebasicpartsofadesktopcomputerarethecomputercase,monitor,keyboard,mouse,andpowercord.Eachpartplaysanimportantrolewheneveryouuseacomputer.Watchthevideobelowtolearnaboutthebasicpartsofacomputer.(Video......
  • Computer Basics 04 - Buttons and Ports on a Computer
     IntroductionTakealookatthefrontandbackofyourcomputercaseandcountthenumberofbuttons,ports,andslotsyousee.Nowlookatyourmonitorandcountanyyoufindthere.Youprobablycountedatleast10,andmaybealotmore.Eachcomputer......
  • vue3 优化ai生成的手写签名
    下面是baiduai生成的代码:在Vue3中实现手写签名功能,可以使用canvas元素来创建一个绘图区域,并监听鼠标事件来实现签名的记录。以下是一个简单的例子:vue<template><div><canvasref="signatureCanvas"@mousedown="startSigning"@mousemove="updat......
  • C# ffmpeg m3u8 ts 视频拼接mp4
    准备拼接文件里面放的是需要拼接视频文件的路径concat_list.txt  准备代码 privatevoidCombineFile(stringfilesDir,stringtargetmp4fileName){stringbasedir=AppDomain.CurrentDomain.BaseDirectory;//ffmpeg的......
  • C# 解密m3u8 ts视频文件为mp4
    代码:try{//读取的加密视频ts文件路径byte[]encodeBuffer=File.ReadAllBytes("C:\\Users\\admin\\Downloads\\322251.ts");///A216DF0DA0082028163781ECC258BA5B代表winhex看到的字符串32734893fb097a767c9ea903936a6d8b代表m3u8文件中的iv偏移......
  • WCHN-CTseg
    WCHN-CTseg前两天我们装了Matlab和SPM12两个软件,今天我们就来讲怎么运行这个CTseg(这是一个可以进行脑CT分割、归一化、颅骨剥离和总脑/颅内容积计算的一个算法~)下载所需包首先要下的两个软件:Matlab和SPM12,详情请看这里:Matlab安装及添加SPM12-Ray-Z-博客园(c......
  • vuex结合websocket使用
    1、创建一个store文件夹,并在其中创建store.js文件,结合vuex:importVuefrom'vue'importVuexfrom'vuex'importcommonfrom"../common/common.js";Vue.use(Vuex)conststore=newVuex.Store({state:{/***是否需要强制登录*/......
  • C117 莫队配合 bitset P4688 [Ynoi2016] 掉进兔子洞
    视频链接:C117莫队配合bitsetP4688[Ynoi2016]掉进兔子洞_哔哩哔哩_bilibili   LuoguP4688[Ynoi2016]掉进兔子洞//莫队配合bitsetO(n*sqrt(n))#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<bitset>usin......
  • LIGGGHTS通过fix freeze命令固定颗粒保持不动
    LIGGGHTS手册中关于fixfreeze命令的用法和解释如下:fixfreezecommand—LIGGGHTSv3.Xdocumentation(cfdem.com)其主要作用时将颗粒上的力和力矩归零。通过fixfreeze命令结合group命令,可以实现让某些颗粒保持固定不动。比如:#把颗粒group,以便freezegroupfixParticle......