uni-app 【报Bug】uts向js暴露函数和类,函数和类方法都有默认参数,无参调用函数正常,类方法报错
uni-app 【报Bug】uts向js暴露函数和类,函数和类方法都有默认参数,无参调用函数正常,类方法报错
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | Windows 10 家庭中文版 | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Windows
HBuilderX类型:正式
HBuilderX版本号:3.99
手机系统:Android
手机系统版本号:Android 13
手机厂商:华为
手机机型:荣耀v30
页面类型:vue
vue版本:vue3
打包方式:云端
项目创建方式:HBuilderX
### 示例代码:
```javascript
export function test(p:string = "test"):void{
console.log(p);
}
export class Text{
constructor(){
}
classtest(p:string = "classtest"):void{
console.log(p);
}
}
import { TTS , test,Text} from "@/uni_modules/ns-tts"
test()
new Text().classtest()
操作步骤:
export function test(p:string = "test"):void{
console.log(p);
}
export class Text{
constructor(){
}
classtest(p:string = "classtest"):void{
console.log(p);
}
}
import { TTS , test,Text} from "@/uni_modules/ns-tts"
test()
new Text().classtest()
预期结果:
分别打印出“test”,“classtest”两个字符串
实际结果:
打印出“test”,接着就报错“Error: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1”
更多关于uni-app 【报Bug】uts向js暴露函数和类,函数和类方法都有默认参数,无参调用函数正常,类方法报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
一般来说,函数和类方法是差不多的,这差异有点大了
更多关于uni-app 【报Bug】uts向js暴露函数和类,函数和类方法都有默认参数,无参调用函数正常,类方法报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html


