Skip to main content
Version: v3.x

widget.setProperty(propertyId, val)

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Set the properties of the UI widget.

Type

(propertyId: string, val: any) => void

Parameters

ParameterDescriptionType
propertyIdThe property of ID.PropertyId
valSet the value. (when property is prop.MORE, val is used in the same way as createWidget's option, which can set multiple parameters.)any

PropertyId

List the properties commonly supported by the components.

PropertiesDescriptionType
xThe x-axis coordinate of the component.number
yThe y-axis coordinate of the component.number
wThe width of the component.number
hThe height of the component.number
VISIBLEWhether the widget is visible or not, true is visible, false is not, this property does not support setProperty(prop.MORE, {}), only setProperty sets the VISIBLE property aloneboolean

Code example

import { createWidget, widget, prop, align } from '@zos/ui'

const button = createWidget(widget.BUTTON, Param)
button.setProperty(prop.VISIBLE, false)

const text = createWidget(widget.TEXT, Param)
text.setProperty(prop.MORE, {
x: 0,
y: 0,
w: 200,
h: 200,
text: 'hello',
color: 0x34e073,
align_h: align.LEFT
})