From df5cb8aff8b65e47cfae18aee9459b22ad2b77d5 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 23 Nov 2023 16:01:14 +0800 Subject: [PATCH] =?UTF-8?q?call-method=EF=BC=9A=E7=A7=BB=E9=99=A4=20?= =?UTF-8?q?=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E9=9D=9E=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../methods/call-method-easycom-uni-modules.uvue | 4 ++-- pages/component-instance/methods/call-method-easycom.uvue | 4 ++-- pages/component-instance/methods/call-method-other.uvue | 4 ++-- pages/component-instance/methods/call-method-uni-element.uvue | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pages/component-instance/methods/call-method-easycom-uni-modules.uvue b/pages/component-instance/methods/call-method-easycom-uni-modules.uvue index e099327..32cce74 100644 --- a/pages/component-instance/methods/call-method-easycom-uni-modules.uvue +++ b/pages/component-instance/methods/call-method-easycom-uni-modules.uvue @@ -38,11 +38,11 @@ }, callMethod5() { // 注意: 返回值可能为 null,当前例子一定不为空,所以加了 ! - const result = this.$callEasyMethod1!.foo5('string1')! as string; + const result = this.$callEasyMethod1!.foo5('string1') as string; console.log(result); // string1 }, callMethodTest(text: string): string | null { - const result = this.$callEasyMethod1!.foo5(text)! as string; + const result = this.$callEasyMethod1!.foo5(text) as string; return result; }, callMethodInOtherFile(text: string): string { diff --git a/pages/component-instance/methods/call-method-easycom.uvue b/pages/component-instance/methods/call-method-easycom.uvue index b0e5d76..a198fe7 100644 --- a/pages/component-instance/methods/call-method-easycom.uvue +++ b/pages/component-instance/methods/call-method-easycom.uvue @@ -36,11 +36,11 @@ }, callMethod5() { // 注意: 返回值可能为 null,当前例子一定不为空,所以加了 ! - const result = this.$callEasyMethod1!.foo5('string1')! as string; + const result = this.$callEasyMethod1!.foo5('string1') as string; console.log(result); // string1 }, callMethodTest(text: string): string | null { - const result = this.$callEasyMethod1!.foo5(text)! as string; + const result = this.$callEasyMethod1!.foo5(text) as string; return result; }, } diff --git a/pages/component-instance/methods/call-method-other.uvue b/pages/component-instance/methods/call-method-other.uvue index ace3c74..fa7efe6 100644 --- a/pages/component-instance/methods/call-method-other.uvue +++ b/pages/component-instance/methods/call-method-other.uvue @@ -46,11 +46,11 @@ callMethod5() { // 通过 $callMethod 调用组件的 foo5 方法并接收返回值 // 注意: 返回值可能为 null,当前例子一定不为空,所以加了 ! - const result = this.$component1!.$callMethod('foo5', 'string1')! as string; + const result = this.$component1!.$callMethod('foo5', 'string1') as string; console.log(result); // string1 }, callMethodTest(text: string): string | null { - const result = this.$component1!.$callMethod('foo5', text)! as string; + const result = this.$component1!.$callMethod('foo5', text) as string; return result; }, } diff --git a/pages/component-instance/methods/call-method-uni-element.uvue b/pages/component-instance/methods/call-method-uni-element.uvue index 469846f..ea28c9e 100644 --- a/pages/component-instance/methods/call-method-uni-element.uvue +++ b/pages/component-instance/methods/call-method-uni-element.uvue @@ -23,7 +23,7 @@ }, callMethodTest(text: string): string | null { this.$slider1!.setAttribute('value', text); - const result = this.$slider1!.getAttribute('value')! as string; + const result = this.$slider1!.getAttribute('value') as string; return result; }, } -- GitLab