报错为../../../../hello-uts/pages/index/index.vue (2:68): "testexp" is not exported by "../../../../hello-uts/uni_modules/uts-helloworld?uts-proxy", imported by "../../../../hello-uts/pages/index/index.vue".
项目是hello-uts
首先新建uni_modules\uts-helloworld\utssdk\testexp.uts文件,代码如下
export function testexp():void{
console.log(123);
}
其次在uni_modules\uts-helloworld\utssdk\index.uts文件中额外添加一行代码
//原有代码......
//新增代码
export * from "./testexp.uts"
最后在pages\index\index.vue文件中导入并调用testexp函数,代码如下
import { callWithJSONParam, callWithStringParam, callWithoutParam, testexp } from "../../uni_modules/uts-helloworld";
testexp()
结果报错
1 个回复
2***@qq.com (作者)
尝试导入hello-uts自带的export * from “...” 也是同样的报错:
../../../../hello-uts/pages/index/index.vue (3:10): "CustomAccessibilityService" is not exported by "../../../../hello-uts/uni_modules/uts-nativepage?uts-proxy", imported by "../../../../hello-uts/pages/index/index.vue".
在pages\index\index.vue文件中额外添加行代码