From 9863c8bbf8391c6c424ab7e07ab1e6e9013c46f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B6=9B?= Date: Fri, 8 May 2020 16:16:41 +0800 Subject: [PATCH] update input demo --- doric-demo/src/InputDemo.ts | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/doric-demo/src/InputDemo.ts b/doric-demo/src/InputDemo.ts index 2130bc95..ac8be244 100644 --- a/doric-demo/src/InputDemo.ts +++ b/doric-demo/src/InputDemo.ts @@ -31,6 +31,21 @@ function getInput(c: Partial) { @Entry class InputDemo extends Panel { build(root: Group) { + var [inputView, ...otherView] = getInput({ + layoutConfig: { + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, + }, + hintText: "Please input something in one line", + border: { + width: 1, + color: Color.GRAY, + }, + multiline: false, + textSize: 20, + maxLength: 20, + padding: { top: 10, bottom: 11 } + }); scroller( vlayout( [ @@ -50,25 +65,15 @@ class InputDemo extends Panel { // textSize: 40, // maxLength: 20, // }), - ...getInput({ - layoutConfig: { - widthSpec: LayoutSpec.FIT, - heightSpec: LayoutSpec.FIT, - }, - hintText: "Please input something in one line", - border: { - width: 1, - color: Color.GRAY, - }, - multiline: false, - textSize: 20, - maxLength: 20, - padding: { top: 10, bottom: 11 } - }), + inputView, + ...otherView, ], { space: 10, - layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT) + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.MOST), + onClick: () => { + (inputView as Input).releaseFocus(context); + } } ), {