Skip to main content
版本:v3

IMG_LEVEL

img_level_sample

通过给定一个图片数组,根据进度(level 属性)去显示对应的图片。

创建 UI 控件

const imgLevel = hmUI.createWidget(hmUI.widget.IMG_LEVEL, Param)

类型

Param: object

属性说明是否必须类型
x控件 x 坐标number
y控件 y 坐标number
image_array图片数组Array<string>
image_length数组大小number
w控件显示宽度,非必须number
h控件显示高度,非必须number
level绘制的图片 [1-image_length]number
警告
  • 如果 w / h 属性没有指定,就会去 image_array 读取图片的宽高作为控件的宽高

代码示例

Page({
build() {
const imgArray = ['img_level_1.png', 'img_level_2.png', 'img_level_3.png', 'img_level_4.png']
const img_level = hmUI.createWidget(hmUI.widget.IMG_LEVEL, {
x: 0,
y: 0,
image_array: imgArray,
image_length: imgArray.length,
level: 1
})
})