diff --git a/pages/SyntaxCase/index.vue b/pages/SyntaxCase/index.vue index 88f19b5557f19990c22931f6c145f3eecafe7585..695191569f7f1d72b9aebdf5df3a31dcb4ba53ef 100644 --- a/pages/SyntaxCase/index.vue +++ b/pages/SyntaxCase/index.vue @@ -13,7 +13,11 @@ 测试return:{{ format(testUtsAsyncResult.return) }} 测试success:{{ format(testUtsAsyncResult.success) }} - 测试complete:{{ format(testUtsAsyncResult.complete) }} + 测试complete:{{ format(testUtsAsyncResult.complete) }} + + 测试return:{{ format(testUtsAsyncMulitParamResult.return) }} + 测试success:{{ format(testUtsAsyncMulitParamResult.success) }} + 测试complete:{{ format(testUtsAsyncMulitParamResult.complete) }} 测试callback:{{ format(testUtsClassConstructorResult.callback) }} @@ -55,7 +59,8 @@ MAX, testSync, testSyncWithCallback, - testAsync, + testAsync, + testAsyncParam3, Test, request, } from "../../uni_modules/uts-syntaxcase"; @@ -77,6 +82,12 @@ success: null, fail: null, complete: null, + }, + testUtsAsyncMulitParamResult: { + return: null, + success: null, + fail: null, + complete: null, }, testUtsClassConstructorResult: { callback: null @@ -124,7 +135,8 @@ testAll() { this.testUtsSync(); this.testUtsSyncWithCallback(); - this.testUtsAsync(); + this.testUtsAsync(); + this.testUtsAsyncMulitParam() this.testUtsClassConstructor(); this.testUtsClassStaticProp(); this.testUtsClassStaticSyncWithCallback(); @@ -195,6 +207,31 @@ this.testUtsAsyncResult.return = true; } } catch (e) {} + }, + async testUtsAsyncMulitParam() { + this.testUtsAsyncMulitParamResult.return = false; + this.testUtsAsyncMulitParamResult.success = false; + // testUtsAsyncResult.fail = false; + this.testUtsAsyncMulitParamResult.complete = false; + try { + const res = await testAsyncParam3(100,"hello",{ + type: "success", + success: (res) => { + console.log("testUtsAsyncMulitParam.success.callback", res); + this.testUtsAsyncMulitParamResult.success = true; + }, + fail: (res) => { + console.log("testUtsAsyncMulitParam.fail.callback", res); + }, + complete: (res) => { + console.log("testUtsAsyncMulitParam.complete.callback", res); + this.testUtsAsyncMulitParamResult.complete = true; + }, + }); + if (res.name === "testUtsAsyncMulitParam") { + this.testUtsAsyncMulitParamResult.return = true; + } + } catch (e) {} }, testUtsClassConstructor() { this.testUtsClassConstructorResult.callback = false diff --git a/uni_modules/uts-syntaxcase/utssdk/index.uts b/uni_modules/uts-syntaxcase/utssdk/index.uts index ed2e57de967f6f1169712e18fc4a8f31ae1f2a5e..9858ac32db567d5ff866dbd8e78cec17459fd7be 100644 --- a/uni_modules/uts-syntaxcase/utssdk/index.uts +++ b/uni_modules/uts-syntaxcase/utssdk/index.uts @@ -95,7 +95,25 @@ export async function testAsync(opts : AsyncOptions) : Promise { } return await testAwaitPromise(res); // return { name: "testAsync" }; -} +} + + +export async function testAsyncParam3(id:number,name:string,opts : AsyncOptions) : Promise { + console.log("id",id,"name",name) + if (opts.type == "success") { + opts.success("success"); + } else { + opts.fail("fail"); + } + opts.complete("complete"); + + const res : SyntaxResult = { + name: "testUtsAsyncMulitParam" + } + return await testAwaitPromise(res); + // return { name: "testAsync" }; +} + export type TestOptions = { name : string;