uni.showToast({
title: '提示',
icon: 'none'
})
- 发布:2022-07-19 14:59
- 更新:2023-09-06 22:41
- 阅读:7881
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macOS
第三方开发者工具版本号: Visual Studio Code1.69.2
基础库版本号: 2.25.0
项目创建方式: CLI
CLI版本号: vite2.9.9
示例代码:
操作步骤:
删除node_modules重新install也是一样
删除node_modules重新install也是一样
预期结果:
正确是找到@dcloudio/types下的uni-app/uni.d.ts中的uni
正确是找到@dcloudio/types下的uni-app/uni.d.ts中的uni
实际结果:
*
*
这边测试并未复现该问题,麻烦提供下可复现demo,谢谢~
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-components": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-h5": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3040820220424001",
"vue": "^3.2.37",
"vue-i18n": "^9.1.9",
"vuex": "^4.0.2"
},
"devDependencies": {
"@dcloudio/types": "^3.0.7",
"@dcloudio/uni-automator": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3040820220424001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3040820220424001",
"typescript": "^4.7.4",
"vite": "^2.9.14"
}
妙 (作者)
通过“npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project”创建项目在vscode打开之后,右下角显示的是No tsconfig,这个时候使用uni上的方法是没有ts提示的,ts没有生效,自然也不会有报错了。这个时候关闭vscode重新进入项目文件,右下角就会显示已经使用tsconfig.json了,就会一直报错说找不到uni
项目创建后根目录就有 tsconfig.json 文件,怎么会 No tsconfig?
-
妙 (作者)
找到问题了,在vscode中的工作区有两个项目以上时,把项目的位置上下移动一下就会出现找不到uni的bug,只有把项目移动到最开始加入工作区的位置才不会报这个bug!
2022-07-20 12:01
妙 (作者)
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-components": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-h5": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3040820220424001",
"vue": "^3.2.37",
"vue-i18n": "^9.1.9",
"vuex": "^4.0.2"
},
"devDependencies": {
"@dcloudio/types": "^3.0.7",
"@dcloudio/uni-automator": "3.0.0-alpha-3040820220424001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3040820220424001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3040820220424001",
"typescript": "^4.7.4",
"vite": "^2.9.14"
}
2022-07-19 17:49
妙 (作者)
复现条件看下面
2022-07-19 17:51