From d58faba864bb0ef7478439bdd00befaebdd80834 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 31 Aug 2023 19:50:30 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20uni-app=20x=20=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=99=A8=E7=9A=84=E7=B1=BB=E5=9E=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/uni-app-x/codegap.md | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/uni-app-x/codegap.md b/docs/uni-app-x/codegap.md index 098fa3b67..146d108af 100644 --- a/docs/uni-app-x/codegap.md +++ b/docs/uni-app-x/codegap.md @@ -176,9 +176,38 @@ foo2(person) ## 编译器的类型优化 -- 生命周期的参数可以省略,参数类型可以省略 -- 模板函数的 event 参数可以省略,但如果参数存在,则必须有类型 -- uni 及 uniCloud API, {} 字面量参数可以省略类型,success, fail, complete 回调函数可以省略,其参数类型也可省略,例如: +- 生命周期的参数及参数类型均可省略。以 `onLoad` 为例: +```ts +// 省略参数 +onLoad() { + console.log('onLoad') +} +// 省略参数类型 +onLoad(options) { + console.log('onLoad') +} +``` +- 模板函数的 event 参数可以省略,但如果参数存在,则必须有类型。 +```html + + +``` +- uni 及 uniCloud API, {} 字面量参数可以省略类型,success, fail, complete 回调函数可以省略,其参数类型也可省略。以 `uni.navigateTo` 为例: ```ts // 省略 {} 字面量参数类型 uni.navigateTo({ -- GitLab