bricks/docs/text.md
2023-12-18 18:15:22 +08:00

3.2 KiB

Text

Text is a widget to show text

用法


<html>
  <head>
    <link href="/bricks/css/bricks.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
  
  <script src="/bricks/bricks.js"></script>
    <script type="text/javascript">
		const opts = 
{
	"widget": {
			"widgettype":"VBox",
			"options":{
			},
			"subwidgets":[
				{
					"widgettype":"Title1",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Title2",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Title3",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Title4",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Title5",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Title6",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"Text",
					"options":{
						"text":"Pic Viewer",
						"i18n":true
					}
				},
				{
					"widgettype":"HBox",
					"options":{
					},
					"subwidgets":[
						{
							"widgettype":"Button",
							"options":{
								"label":"A",
								"item_rate":1.4
							},
							"binds":[
								{
									"wid":"self",
									"event":"click",
									"actiontype":"script",
									"target":"app",
									"script":"bricks_app.textsize_bigger()"
								}
							]
						},
						{
							"widgettype":"Button",
							"options":{
								"label":"A",
								"item_rate":0.7,
								"item_size":"20px"
							},
							"binds":[
								{
									"wid":"self",
									"event":"click",
									"actiontype":"script",
									"target":"app",
									"script":"bricks_app.textsize_smaller()"
								}
							]
						}
					]
				}
			]
		}
}

		;
		const app = new BricksApp(opts);
		app.run();


</script>
  </body>
</html>

效果图

widget参数说明

参数 参数说明 类型 是否必填 可选值 默认值
widgettype 控件类型 String --- ---
options 控件的配置项 Object --- ---
subwidgets 控件子项的配置 Object --- ---

widget.subwidgets参数说明

参数 参数说明 类型 是否必填 可选值 默认值
widgettype 控件类型 String --- ---
options 控件的配置项 Object --- ---

options参数说明

参数 参数说明 类型 是否必填 可选值 默认值
text 默认显示的值 String --- ---
i18n 是否国际化 Boolean true/false ---