js:Input add input statement function

This commit is contained in:
pengfei.zhou 2019-12-31 18:16:55 +08:00 committed by osborn
parent 7e04671ca7
commit 1b0695d317

View File

@ -17,6 +17,7 @@ import { View, IView, Property } from "../ui/view";
import { Color } from "../util/color"; import { Color } from "../util/color";
import { Gravity } from "../util/gravity"; import { Gravity } from "../util/gravity";
import { BridgeContext } from "../runtime/global"; import { BridgeContext } from "../runtime/global";
import { layoutConfig } from "../util/index.util";
export interface IInput extends IView { export interface IInput extends IView {
text?: string text?: string
@ -78,3 +79,12 @@ export class Input extends View implements IInput {
return this.nativeChannel(context, 'releaseFocus')() return this.nativeChannel(context, 'releaseFocus')()
} }
} }
export function input(config: IInput) {
const ret = new Input
ret.layoutConfig = layoutConfig().just()
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret)
}
return ret
}