js:Input add input statement function
This commit is contained in:
		| @@ -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 | ||||||
| @@ -77,4 +78,13 @@ export class Input extends View implements IInput { | |||||||
|     releaseFocus(context: BridgeContext) { |     releaseFocus(context: BridgeContext) { | ||||||
|         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 | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user