diff --git a/pages/SyntaxCase/index.uvue b/pages/SyntaxCase/index.uvue
index 73821e336230b287d7af5b6f6f6fa8bd984524ee..e3322dbee6764b3658ff5af35ac07a9108cf85e6 100644
--- a/pages/SyntaxCase/index.uvue
+++ b/pages/SyntaxCase/index.uvue
@@ -50,7 +50,9 @@
测试return:{{ format(testUtsClassInstanceResult['return']) }}
测试success:{{ format(testUtsClassInstanceResult['success']) }}
测试complete:{{ format(testUtsClassInstanceResult['complete']) }}
- 测试callback:{{ format(testUtsClassInstanceResult['callback']) }}
+ 测试callback:{{ format(testUtsClassInstanceResult['callback']) }}
+
+ 测试setter:{{ format(testUtsClassSetterResult) }}
@@ -68,7 +70,8 @@
SyncOptions,
testAsyncParam3,
Test,
- request,
+ request,
+ SetterTest,
} from "../../uni_modules/uts-syntaxcase";
// #endif
let test:Test|null = null
@@ -131,7 +134,8 @@
fail: null,
complete: null,
callback: null
- }
+ },
+ testUtsClassSetterResult: null,
}
},
methods: {
@@ -156,7 +160,8 @@
this.testUtsClassProp();
this.testUtsClassSyncWithCallback();
this.testUtsClassAsync();
- this.testUtsClassInstance();
+ this.testUtsClassInstance();
+ this.testUtsClassSetter();
},
testUtsSync() {
this.testUtsSyncResult = false;
@@ -424,7 +429,19 @@
if (res === 'sync') {
this.testUtsClassInstanceResult['return'] = true;
}
- }
+ },
+ testUtsClassSetter() {
+ this.testUtsClassSetterResult = false;
+ try {
+ let obj = new SetterTest()
+ obj.nickName = "Tom";
+ if (obj.nickName == "Tom") {
+ this.testUtsClassSetterResult = true;
+ }
+ } catch (e) {
+ console.error("testUtsClassSetter", e);
+ }
+ },
}
}
\ No newline at end of file
diff --git a/pages/SyntaxCase/index.vue b/pages/SyntaxCase/index.vue
index 695191569f7f1d72b9aebdf5df3a31dcb4ba53ef..19404648542fe84742d75e31f5003a62832ab72b 100644
--- a/pages/SyntaxCase/index.vue
+++ b/pages/SyntaxCase/index.vue
@@ -49,7 +49,9 @@
测试return:{{ format(testUtsClassInstanceResult.return) }}
测试success:{{ format(testUtsClassInstanceResult.success) }}
测试complete:{{ format(testUtsClassInstanceResult.complete) }}
- 测试callback:{{ format(testUtsClassInstanceResult.callback) }}
+ 测试callback:{{ format(testUtsClassInstanceResult.callback) }}
+
+ 测试setter:{{ format(testUtsClassSetterResult) }}
@@ -62,7 +64,8 @@
testAsync,
testAsyncParam3,
Test,
- request,
+ request,
+ SetterTest,
} from "../../uni_modules/uts-syntaxcase";
// #endif
let test
@@ -125,7 +128,8 @@
fail: null,
complete: null,
callback: null
- }
+ },
+ testUtsClassSetterResult: null,
}
},
methods: {
@@ -144,7 +148,8 @@
this.testUtsClassProp();
this.testUtsClassSyncWithCallback();
this.testUtsClassAsync();
- this.testUtsClassInstance();
+ this.testUtsClassInstance();
+ this.testUtsClassSetter();
},
testUtsSync() {
this.testUtsSyncResult = false;
@@ -405,7 +410,19 @@
if (res === 'sync') {
this.testUtsClassInstanceResult.return = true;
}
- }
+ },
+ testUtsClassSetter() {
+ this.testUtsClassSetterResult = false;
+ try {
+ let obj = new SetterTest()
+ obj.nickName = "Tom";
+ if (obj.nickName == "Tom") {
+ this.testUtsClassSetterResult = true;
+ }
+ } catch (e) {
+ console.error("testUtsClassSetter", e);
+ }
+ },
}
}
\ No newline at end of file
diff --git a/uni_modules/uts-syntaxcase/utssdk/index.uts b/uni_modules/uts-syntaxcase/utssdk/index.uts
index 1c887a9530761a4976495cb8cc2f40c38ff9ca67..60350dd8f86bf013b0b3b79ab27ffe8a8fa92d9c 100644
--- a/uni_modules/uts-syntaxcase/utssdk/index.uts
+++ b/uni_modules/uts-syntaxcase/utssdk/index.uts
@@ -100,7 +100,8 @@ export async function testAsyncParam3(id : number, name : string, opts : AsyncOp
export class Test {
id : number;
- name : string;
+ name : string;
+
static type : string = "Test";
constructor(id : number, options : TestOptions) {
this.id = id;
@@ -121,6 +122,21 @@ export class Test {
const res = await testAsync(opts);
return res;
}
+}
+
+export class SetterTest {
+
+ private _nickName: string = '';
+
+ get nickName (): string {
+ console.log('get nickName');
+ return this._nickName;
+ }
+ set nickName (value: string) {
+ console.log('set nickName');
+ this._nickName = value;
+ }
+
}
class RequestTaskImpl implements RequestTask {