下载的代码:npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project
运行的代码:
uni.startWifi({
success() {
console.log('success');
},
fail() {
console.log('fail');
}
})
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: Windows 10 企业版 LTSC
HBuilderX类型: 正式
HBuilderX版本号: 3.99
手机系统: Android
手机系统版本号: Android 14
手机厂商: 小米
手机机型: Redmi K60
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
下载的代码:npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project
运行的代码:
uni.startWifi({
success() {
console.log('success');
},
fail() {
console.log('fail');
}
})
运行到手机模拟器 android app 基座
可以正常运行
x Union Type is not supported.
11:01:40.299 x Union Type is not supported.
11:01:40.299 at uni_modules/uni-wifi/utssdk/interface.uts:101:1
11:01:40.301 100 | /
11:01:40.302 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:40.303 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:01:40.305 101 |
11:01:40.305 `----
11:01:40.306 x Expected '{', got ';'
11:01:40.307 at uni_modules/uni-wifi/utssdk/interface.uts:101:1
11:01:40.308 100 | /
11:01:40.309 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:40.309 : ^
11:01:40.310 101 |
11:01:40.310 ---- 11:01:40.311 Caused by: 11:01:40.312 Syntax Error 11:01:40.314 Error: 11:01:40.314 x Union Type is not supported. 11:01:40.315 at uni_modules/uni-wifi/utssdk/interface.uts:101:1 11:01:40.315 100 | */ 11:01:40.316 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013; 11:01:40.318 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11:01:40.318 101 | 11:01:40.319
----
11:01:40.320 x Expected '{', got ';'
11:01:40.320 at uni_modules/uni-wifi/utssdk/interface.uts:101:1
11:01:40.323 100 | /
11:01:40.323 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:40.324 : ^
11:01:40.325 101 |
11:01:40.326 `----
11:01:40.327 Caused by:
11:01:40.327 Syntax Error
11:01:41.961 [plugin:uni:uts] Cannot create property 'code' on string 'load_transformed failed
11:01:41.961 Caused by:
11:01:41.962 0: Bundler.load() failed
11:01:41.962 1: Bundler.loader.load(C:\Users\Administrator\Desktop\test\drong-screen-web\src\uni_modules\uni-wifi\utssdk\interface.uts) failed
11:01:41.964 2:
11:01:41.964 x Union Type is not supported.
11:01:41.965 at uni_modules/uni-wifi/utssdk/interface.uts:99:1
11:01:41.965 98 | - 12010 系统其他错误
11:01:41.967 99 | - 12013 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持
11:01:41.967 100 | /
11:01:41.968 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:41.968 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:01:41.969 102 |
11:01:41.970 103 | export interface WifiFail extends IUniError{
11:01:41.971 104 | errCode: WifiErrorCode
11:01:41.972 ---- 11:01:41.973 x Expected '{', got ';' 11:01:41.973 at uni_modules/uni-wifi/utssdk/interface.uts:99:1 11:01:41.975 98 | * - 12010 系统其他错误 11:01:41.976 99 | * - 12013 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 11:01:41.976 100 | */ 11:01:41.977 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013; 11:01:41.977 : ^ 11:01:41.979 102 | 11:01:41.979 103 | export interface WifiFail extends IUniError{ 11:01:41.980 104 | errCode: WifiErrorCode 11:01:41.980
----
11:01:41.982 3: Syntax Error
11:01:41.982 Error: load_transformed failed
11:01:41.983 Caused by:
11:01:41.983 0: Bundler.load() failed
11:01:41.984 1: Bundler.loader.load(C:\Users\Administrator\Desktop\test\drong-screen-web\src\uni_modules\uni-wifi\utssdk\interface.uts) failed
11:01:41.984 2:
11:01:41.986 x Union Type is not supported.
11:01:41.987 at uni_modules/uni-wifi/utssdk/interface.uts:99:1
11:01:41.987 98 | - 12010 系统其他错误
11:01:41.988 99 | - 12013 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持
11:01:41.988 100 | /
11:01:41.989 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:41.990 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:01:41.991 102 |
11:01:41.992 103 | export interface WifiFail extends IUniError{
11:01:41.992 104 | errCode: WifiErrorCode
11:01:41.994 `----
11:01:41.994 x Expected '{', got ';'
11:01:41.995 at uni_modules/uni-wifi/utssdk/interface.uts:99:1
11:01:41.995 98 | - 12010 系统其他错误
11:01:41.996 99 | - 12013 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持
11:01:41.996 100 | /
11:01:41.998 101 | export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
11:01:41.999 : ^
11:01:41.999 102 |
11:01:42.000 103 | export interface WifiFail extends IUniError{
11:01:42.001 104 | errCode: WifiErrorCode
11:01:42.002 `----
11:01:42.002 3: Syntax Error'
11:01:42.003 at uni_modules/uni-wifi:1:0
dcloud的相关依赖包不是最新的。
2***@qq.com (作者)
{
"name": "uni-preset-vue",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-3081220230817001",
"@dcloudio/uni-app-plus": "3.0.0-3081220230817001",
"@dcloudio/uni-components": "3.0.0-3081220230817001",
"@dcloudio/uni-h5": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-alipay": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-baidu": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-jd": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-lark": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-qq": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-toutiao": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-weixin": "3.0.0-3081220230817001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3081220230817001",
"vue": "^3.2.45",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-3081220230817001",
"@dcloudio/uni-cli-shared": "3.0.0-3081220230817001",
"@dcloudio/uni-stacktracey": "3.0.0-3081220230817001",
"@dcloudio/uni-uts-v1": "^3.0.0-3081220230817001",
"@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001",
"@vue/runtime-core": "^3.2.45",
"@vue/tsconfig": "^0.1.3",
"typescript": "^4.9.4",
"vite": "4.1.4",
"vue-tsc": "^1.0.24"
}
}
2024-01-10 10:57
2***@qq.com (作者)
抱歉是我之前的操作方式不对,按您说的换了最新的依赖包就解决了 @dcloudio/uni-uts-v1@3.0.0-alpha-4000020231227002
2024-01-10 15:24
2***@qq.com (作者)
请问官方是否是尝试过 npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project 下载最新的包并且使用 uni-wifi 看是否可行
2***@qq.com (作者)
使用 Hbuilder X 创建的项目可以
2024-01-10 09:56