js: add navbar set center api

This commit is contained in:
王劲鹏
2020-04-30 14:53:09 +08:00
committed by osborn
parent cc5a7ab011
commit d8649ac539
10 changed files with 80 additions and 21 deletions

View File

@@ -118,6 +118,30 @@ class NavbarDemo extends Panel {
})
}
}),
label('setCenter').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
navbar(context).setCenter(hlayout([
text({
width: 70,
height: 44,
textColor: Color.BLACK,
layoutConfig: layoutConfig().just().configAlignment(Gravity.Center),
text: "Center",
}),
]).apply({
backgroundColor: Color.RED
}))
.catch(e => {
modal(context).alert(e)
})
}
}),
label('Pop').apply({
width: 200,
height: 50,