31 Star 228 Fork 113

帝莎编程 / tov-template

 / 详情

关于import {App}提示需要type关键字

已完成
创建于  
2022-05-12 14:00

老师,按照您说的安装了您写的插件vite-plugin-use-modules,然后按照配置做了配置,可以这样写了
import type { App } from 'vue'
export default (app: App) => app.use(createPinia())
但是还有个小问题,提示必须import后面有type关键字,您的模板里面可以没有这个关键字,查了一圈没有找到原因,
老师能否再指点一下,是需要配置哪里吗?

评论 (5)

stoven_lin 创建了任务
markthree 任务状态待办的 修改为进行中
markthree 负责人设置为markthree
展开全部操作日志

靓仔你好,请上传对应代码和提示

写成import type { App } from 'vue'这样就不报错了,也能成功运行

@stoven_lin 请用 import type { App } from 'vue', 直接导入类型已经是不推荐的了

markthree 任务状态进行中 修改为已完成
markthree 任务状态已完成 修改为进行中

@stoven_lin 你可以了解下 tsconfig.json 中的各种配置,直接 create vite 出来的 tsconfig.json 会更严格

markthree 任务状态进行中 修改为已完成
markthree 添加了
 
question
标签

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
10249119 markthree 1640753343 3046301 stoven 1578973647
TypeScript
1
https://gitee.com/dishait/tov-template.git
git@gitee.com:dishait/tov-template.git
dishait
tov-template
tov-template

搜索帮助

53164aa7 5694891 3bd8fe86 5694891