update input demo

This commit is contained in:
刘涛 2020-05-08 16:16:41 +08:00 committed by osborn
parent c66466f241
commit 9863c8bbf8

View File

@ -31,6 +31,21 @@ function getInput(c: Partial<Input>) {
@Entry @Entry
class InputDemo extends Panel { class InputDemo extends Panel {
build(root: Group) { 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( scroller(
vlayout( vlayout(
[ [
@ -50,25 +65,15 @@ class InputDemo extends Panel {
// textSize: 40, // textSize: 40,
// maxLength: 20, // maxLength: 20,
// }), // }),
...getInput({ inputView,
layoutConfig: { ...otherView,
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 }
}),
], ],
{ {
space: 10, space: 10,
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT) layoutConfig: layoutConfig().most().configHeight(LayoutSpec.MOST),
onClick: () => {
(inputView as Input).releaseFocus(context);
}
} }
), ),
{ {