{"id":1693,"date":"2024-03-25T10:01:20","date_gmt":"2024-03-25T02:01:20","guid":{"rendered":"https:\/\/fireinsect.top\/?p=1693"},"modified":"2024-03-25T11:21:32","modified_gmt":"2024-03-25T03:21:32","slug":"harmonyos%e5%bc%80%e5%8f%91%e5%ad%a6%e4%b9%a0%ef%bc%883%ef%bc%89-%e9%a1%b5%e9%9d%a2%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/fireinsect.top\/index.php\/2024\/03\/25\/harmonyos%e5%bc%80%e5%8f%91%e5%ad%a6%e4%b9%a0%ef%bc%883%ef%bc%89-%e9%a1%b5%e9%9d%a2%e5%bc%80%e5%8f%91\/","title":{"rendered":"HarmonyOS\u5f00\u53d1\u5b66\u4e60\uff083\uff09\u2013\u9875\u9762\u5f00\u53d1"},"content":{"rendered":"\n<!--more-->\n\n\n\n<p>\u7ec4\u4ef6\u662f\u754c\u9762\u642d\u5efa\u4e0e\u663e\u793a\u7684\u6700\u5c0f\u5355\u4f4d\uff0c\u7ec4\u4ef6\u6839\u636e\u529f\u80fd\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u4e94\u5927\u7c7b\uff1a\u57fa\u7840\u7ec4\u4ef6\u3001\u5bb9\u5668\u7ec4\u4ef6\u3001\u5a92\u4f53\u7ec4\u4ef6\u3001\u7ed8\u5236\u7ec4\u4ef6\u3001\u753b\u5e03\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.Text<\/h2>\n\n\n\n<p>Text\u7ec4\u4ef6\u7528\u4e8e\u5728\u754c\u9762\u4e0a\u5c55\u793a\u4e00\u6bb5\u6587\u672c\u4fe1\u606f\uff0c\u53ef\u4ee5\u5305\u542b\u5b50\u7ec4\u4ef6Span\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>\u540d\u79f0<\/td><td>\u53c2\u6570\u7c7b\u578b<\/td><td>\u63cf\u8ff0<\/td><\/tr><tr><td>fontColor<\/td><td>ResourceColor<\/td><td>\u8bbe\u7f6e\u6587\u672c\u989c\u8272\u3002<\/td><\/tr><tr><td>fontSize<\/td><td>Length | Resource<\/td><td>\u8bbe\u7f6e\u6587\u672c\u5c3a\u5bf8\uff0cLength\u4e3anumber\u7c7b\u578b\u65f6\uff0c\u4f7f\u7528fp\u5355\u4f4d\u3002<\/td><\/tr><tr><td>fontStyle<\/td><td>FontStyle<\/td><td>\u8bbe\u7f6e\u6587\u672c\u7684\u5b57\u4f53\u6837\u5f0f\u3002\u9ed8\u8ba4\u503c\uff1aFontStyle.Normal\u3002<\/td><\/tr><tr><td>fontWeight<\/td><td>number | FontWeight | string<\/td><td>\u8bbe\u7f6e\u6587\u672c\u7684\u5b57\u4f53\u7c97\u7ec6\uff0cnumber\u7c7b\u578b\u53d6\u503c[100, 900]\uff0c\u53d6\u503c\u95f4\u9694\u4e3a100\uff0c\u9ed8\u8ba4\u4e3a400\uff0c\u53d6\u503c\u8d8a\u5927\uff0c\u5b57\u4f53\u8d8a\u7c97\u3002string\u7c7b\u578b\u4ec5\u652f\u6301number\u7c7b\u578b\u53d6\u503c\u7684\u5b57\u7b26\u4e32\u5f62\u5f0f\uff0c\u4f8b\u5982\u201c400\u201d\uff0c\u4ee5\u53ca\u201cbold\u201d\u3001\u201cbolder\u201d\u3001\u201clighter\u201d\u3001\u201cregular\u201d\u3001\u201cmedium\u201d\uff0c\u5206\u522b\u5bf9\u5e94FontWeight\u4e2d\u76f8\u5e94\u7684\u679a\u4e3e\u503c\u3002\u9ed8\u8ba4\u503c\uff1aFontWeight.Normal\u3002<\/td><\/tr><tr><td>fontFamily<\/td><td>string | Resource<\/td><td>\u8bbe\u7f6e\u6587\u672c\u7684\u5b57\u4f53\u5217\u8868\u3002\u4f7f\u7528\u591a\u4e2a\u5b57\u4f53\uff0c\u4f7f\u7528\u201c\uff0c\u201d\u8fdb\u884c\u5206\u5272\uff0c\u4f18\u5148\u7ea7\u6309\u987a\u5e8f\u751f\u6548\u3002\u4f8b\u5982\uff1a\u201cArial\uff0csans-serif\u201d\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TextDemo {\n  build() {\n    Row() {\n      Column() {\n        Text('HarmonyOS')\n        Text('HarmonyOS')\n          .fontColor(Color.Blue)\n          .fontSize(20)\n          .fontStyle(FontStyle.Italic)\n          .fontWeight(FontWeight.Bold)\n          .fontFamily('Arial')\n      }\n      .width('100%')\n    }\n    .backgroundColor(0xF1F3F5)\n    .height('100%')\n  }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u6587\u672c\u5bf9\u9f50\u65b9\u5f0f<\/h3>\n\n\n\n<p>\u4f7f\u7528textAlign\u5c5e\u6027\u53ef\u4ee5\u8bbe\u7f6e\u6587\u672c\u7684\u5bf9\u9f50\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">  .textAlign(TextAlign.Start)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start\uff08\u9ed8\u8ba4\u503c\uff09\uff1a\u6c34\u5e73\u5bf9\u9f50\u9996\u90e8\u3002<\/li>\n\n\n\n<li>Center\uff1a\u6c34\u5e73\u5c45\u4e2d\u5bf9\u9f50\u3002<\/li>\n\n\n\n<li>End\uff1a\u6c34\u5e73\u5bf9\u9f50\u5c3e\u90e8\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u6587\u672c\u8d85\u957f\u663e\u793a<\/h3>\n\n\n\n<p>\u5f53\u6587\u672c\u5185\u5bb9\u8f83\u591a\u8d85\u51fa\u4e86Text\u7ec4\u4ef6\u8303\u56f4\u7684\u65f6\u5019\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528textOverflow\u8bbe\u7f6e\u6587\u672c\u622a\u53d6\u65b9\u5f0f\uff0c\u9700\u914d\u5408maxLines\u4f7f\u7528\uff0c\u5355\u72ec\u8bbe\u7f6e\u4e0d\u751f\u6548\uff0cmaxLines\u7528\u4e8e\u8bbe\u7f6e\u6587\u672c\u663e\u793a\u6700\u5927\u884c\u6570\u3002\u4e0b\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u5c06textOverflow\u8bbe\u7f6e\u4e3aEllipsis \uff0c\u5b83\u5c06\u663e\u793a\u4e0d\u4e0b\u7684\u6587\u672c\u7528 \u201c&#8230;\u201d \u8868\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Text('This is the text content of Text Component This is the text content of Text Component')\n  .fontSize(16)\n  .maxLines(1)\n  .textOverflow({overflow:TextOverflow.Ellipsis})\n  .backgroundColor(0xE6F2FD) <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u6587\u672c\u88c5\u9970\u7ebf<\/h3>\n\n\n\n<p>\u4f7f\u7528decoration\u8bbe\u7f6e\u6587\u672c\u88c5\u9970\u7ebf\u6837\u5f0f\u53ca\u5176\u989c\u8272\uff0c\u5927\u5bb6\u5728\u6d4f\u89c8\u7f51\u9875\u7684\u65f6\u5019\u7ecf\u5e38\u53ef\u4ee5\u770b\u5230\u88c5\u9970\u7ebf\uff0c\u4f8b\u5982\u5e26\u6709\u4e0b\u5212\u7ebf\u8d85\u94fe\u63a5\u6587\u672c\u3002decoration\u5305\u542btype\u548ccolor\u4e24\u4e2a\u53c2\u6570\uff0c\u5176\u4e2dtype\u7528\u4e8e\u8bbe\u7f6e\u88c5\u9970\u7ebf\u6837\u5f0f\uff0c\u53c2\u6570\u7c7b\u578b\u4e3aTextDecorationType\uff0ccolor\u4e3a\u53ef\u9009\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Text('HarmonyOS')\n  .fontSize(20)\n  .decoration({ type: TextDecorationType.Underline, color: Color.Black })\n  .backgroundColor(0xE6F2FD)<\/code><\/pre>\n\n\n\n<p>\u5b58\u5728\u4e0b\u9762\u51e0\u4e2a\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-1 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>None\uff1a\u4e0d\u4f7f\u7528\u6587\u672c\u88c5\u9970\u7ebf\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"157\" height=\"36\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-17.png?resize=157%2C36&#038;ssl=1\" alt=\"\" class=\"wp-image-1695\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-2 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>Overline\uff1a\u6587\u5b57\u4e0a\u5212\u7ebf\u4fee\u9970\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"158\" height=\"34\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-18.png?resize=158%2C34&#038;ssl=1\" alt=\"\" class=\"wp-image-1696\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-3 wp-block-group-is-layout-flex\">\n<p>LineThrough\uff1a\u7a7f\u8fc7\u6587\u672c\u7684\u4fee\u9970\u7ebf\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"160\" height=\"36\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-19.png?resize=160%2C36&#038;ssl=1\" alt=\"\" class=\"wp-image-1699\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Underline\uff1a\u6587\u5b57\u4e0b\u5212\u7ebf\u4fee\u9970\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"157\" height=\"34\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-20.png?resize=157%2C34&#038;ssl=1\" alt=\"\" class=\"wp-image-1700\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-4 wp-block-group-is-layout-flex\">\n<h2 class=\"wp-block-heading\">2.Image<\/h2>\n\n\n\n<p>Image\u7ec4\u4ef6\u7528\u4e8e\u6e32\u67d3\u5c55\u793a\u56fe\u7247\u5982\uff1a<\/p>\n<\/div>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Image($r(\"app.media.icon\"))\n  .width(100)\n  .height(100)<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-5 wp-block-group-is-layout-flex\">\n<p>\u4e3a\u4e86\u4f7f\u56fe\u7247\u5728\u9875\u9762\u4e2d\u6709\u66f4\u597d\u7684\u663e\u793a\u6548\u679c\uff0c\u6709\u65f6\u5019\u9700\u8981\u5bf9\u56fe\u7247\u8fdb\u884c\u7f29\u653e\u5904\u7406\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528objectFit\u5c5e\u6027\u8bbe\u7f6e\u56fe\u7247\u7684\u7f29\u653e\u7c7b\u578b\uff0cobjectFit\u7684\u53c2\u6570\u7c7b\u578b\u4e3aImageFit\u3002<\/p>\n<\/div>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Image($r(\"app.media.image2\"))\n  .objectFit(ImageFit.Cover)\n  .backgroundColor(0xCCCCCC)\n  .width(100)\n  .height(100) <\/code><\/pre>\n\n\n\n<p>ImageFit\u5b58\u5728\u4ee5\u4e0b\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-6 wp-block-group-is-layout-flex\">\n<p>Contain\uff1a\u4fdd\u6301\u5bbd\u9ad8\u6bd4\u8fdb\u884c\u7f29\u5c0f\u6216\u8005\u653e\u5927\uff0c\u4f7f\u5f97\u56fe\u7247\u5b8c\u5168\u663e\u793a\u5728\u663e\u793a\u8fb9\u754c\u5185\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i2.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102114756.85370236529918272452949887734853:50001231000000:2800:F979D2A17F79AB04523A87103269E8E3BB4C63A9BA65E6B1BFB298CED56610AA.png?w=1170&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Cover\uff08\u9ed8\u8ba4\u503c\uff09\uff1a\u4fdd\u6301\u5bbd\u9ad8\u6bd4\u8fdb\u884c\u7f29\u5c0f\u6216\u8005\u653e\u5927\uff0c\u4f7f\u5f97\u56fe\u7247\u4e24\u8fb9\u90fd\u5927\u4e8e\u6216\u7b49\u4e8e\u663e\u793a\u8fb9\u754c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102114803.14650992439248534530091313002089:50001231000000:2800:E532173B3B6DD9E92259F72675697BCEAE09FE72485AEA9EFD5FE9794FF14521.png?w=1170&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Auto\uff1a\u81ea\u9002\u5e94\u663e\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i2.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102114822.02052799258986122197086618380763:50001231000000:2800:190ECE96A361A13874FAAEA025A05042FC3D8E342712FC156BA48E7CFEFD40D1.png?resize=164%2C164&#038;ssl=1\" alt=\"\" width=\"164\" height=\"164\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Fill\uff1a\u4e0d\u4fdd\u6301\u5bbd\u9ad8\u6bd4\u8fdb\u884c\u653e\u5927\u7f29\u5c0f\uff0c\u4f7f\u5f97\u56fe\u7247\u5145\u6ee1\u663e\u793a\u8fb9\u754c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i2.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102114940.81869569958898798079916961462275:50001231000000:2800:5B61B3C66E719CA10CA11E6E7AE81BDC98D1A3F472A07ADE97C446AA04DAAE8D.png?w=1170&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>ScaleDown\uff1a\u4fdd\u6301\u5bbd\u9ad8\u6bd4\u663e\u793a\uff0c\u56fe\u7247\u7f29\u5c0f\u6216\u8005\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102114951.52445007947325457633854339454055:50001231000000:2800:FA807656E11E50469F5271B238470C6851F0D4ED5498914110CA07EFE52A80DE.png?w=1170&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>None\uff1a\u4fdd\u6301\u539f\u6709\u5c3a\u5bf8\u663e\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/103\/404\/958\/0260086000103404958.20221102115000.02884099972463949183812198219733:50001231000000:2800:076F73E497FD71E0338C04471F3B5770E5CCB46D3EE80A6A7565E6C503550E5D.png?w=1170&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u52a0\u8f7d\u7f51\u7edc\u56fe\u7247<\/h3>\n\n\n\n<p>Image\u7ec4\u4ef6\u652f\u6301\u52a0\u8f7d\u7f51\u7edc\u56fe\u7247\uff0c\u5c06\u56fe\u7247\u5730\u5740\u6362\u6210\u7f51\u7edc\u5730\u5740\u8fdb\u884c\u52a0\u8f7d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Image('https:\/\/www.example.com\/xxx.png')<\/code><\/pre>\n\n\n\n<p>\u4e3a\u4e86\u6210\u529f\u52a0\u8f7d\u7f51\u7edc\u56fe\u7247\uff0c\u60a8\u9700\u8981\u518dmodule.json5\u6587\u4ef6\u4e2d\u7533\u660e\u7f51\u7edc\u8bbf\u95ee\u6743\u9650\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">{\n    \"module\" : {\n        \"requestPermissions\":[\n           {\n             \"name\": \"ohos.permission.INTERNET\"\n           }\n        ]\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3.TextInput<\/h2>\n\n\n\n<p>TextInput\u7ec4\u4ef6\u7528\u4e8e\u8f93\u5165\u5355\u884c\u6587\u672c\uff0c\u54cd\u5e94\u8f93\u5165\u4e8b\u4ef6\u3002TextInput\u7684\u4f7f\u7528\u4e5f\u975e\u5e38\u5e7f\u6cdb\uff0c\u4f8b\u5982\u5e94\u7528\u767b\u5f55\u8d26\u53f7\u5bc6\u7801\u3001\u53d1\u9001\u6d88\u606f\u7b49\u3002\u548cText\u7ec4\u4ef6\u4e00\u6837\uff0cTextInput\u7ec4\u4ef6\u4e5f\u652f\u6301\u6587\u672c\u6837\u5f0f\u8bbe\u7f6e\uff0c\u4e0b\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u5b9e\u73b0\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u8f93\u5165\u6846\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">TextInput()\n  .fontColor(Color.Blue)\n  .fontSize(20)\n  .fontStyle(FontStyle.Italic)\n  .fontWeight(FontWeight.Bold)\n  .fontFamily('Arial') <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u8f93\u5165\u63d0\u793a\u6587\u5b57<\/h3>\n\n\n\n<p>\u4f7f\u7528placeholder\u5c5e\u6027\u5c31\u53ef\u4ee5\u5b9e\u73b0\u63d0\u793a\u6587\u5b57\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528placeholderColor\u548cplaceholderFont\u5206\u522b\u8bbe\u7f6e\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u548c\u6837\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">TextInput({ placeholder: '\u8bf7\u8f93\u5165\u5e10\u53f7' })\n  .placeholderColor(0x999999)\n  .placeholderFont({ size: 20, weight: FontWeight.Medium, family: 'cursive', style: FontStyle.Italic })<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u8f93\u5165\u7c7b\u578b<\/h3>\n\n\n\n<p>\u4f7f\u7528type\u5c5e\u6027\u6765\u8bbe\u7f6e\u8f93\u5165\u6846\u7c7b\u578b\uff0c\u5982\u5bc6\u7801\u8f93\u5165\u6846\uff0c\u53ef\u4ee5\u5c06type\u5c5e\u6027\u8bbe\u7f6e\u4e3aInputType.Password\u6765\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">TextInput({ placeholder: '\u8bf7\u8f93\u5165\u5bc6\u7801' })\n  .type(InputType.Password)<\/code><\/pre>\n\n\n\n<p>\u9664\u6b64\u4e4b\u5916\u8fd8\u6709\u4ee5\u4e0b\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-7 wp-block-group-is-layout-flex\">\n<p>Normal\uff1a\u57fa\u672c\u8f93\u5165\u6a21\u5f0f\u3002\u652f\u6301\u8f93\u5165\u6570\u5b57\u3001\u5b57\u6bcd\u3001\u4e0b\u5212\u7ebf\u3001\u7a7a\u683c\u3001\u7279\u6b8a\u5b57\u7b26\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"75\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-21.png?resize=600%2C75&#038;ssl=1\" alt=\"\" class=\"wp-image-1705\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-21.png?w=600&amp;ssl=1 600w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-21.png?resize=300%2C38&amp;ssl=1 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Password\uff1a\u5bc6\u7801\u8f93\u5165\u6a21\u5f0f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"75\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-22.png?resize=599%2C75&#038;ssl=1\" alt=\"\" class=\"wp-image-1706\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-22.png?w=599&amp;ssl=1 599w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-22.png?resize=300%2C38&amp;ssl=1 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Email\uff1ae-mail\u5730\u5740\u8f93\u5165\u6a21\u5f0f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"75\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-23.png?resize=599%2C75&#038;ssl=1\" alt=\"\" class=\"wp-image-1707\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-23.png?w=599&amp;ssl=1 599w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-23.png?resize=300%2C38&amp;ssl=1 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Number\uff1a\u7eaf\u6570\u5b57\u8f93\u5165\u6a21\u5f0f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"75\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-24.png?resize=600%2C75&#038;ssl=1\" alt=\"\" class=\"wp-image-1708\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-24.png?w=600&amp;ssl=1 600w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-24.png?resize=300%2C38&amp;ssl=1 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e<\/h3>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528TextInputController\u52a8\u6001\u8bbe\u7f6e\u5149\u4f4d\u7f6e\uff0c\u4e0b\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u4f7f\u7528TextInputController\u7684caretPosition\u65b9\u6cd5\uff0c\u5c06\u5149\u6807\u79fb\u52a8\u5230\u4e86\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u540e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TextInputDemo {\n  controller: TextInputController = new TextInputController()\n \n  build() {\n    Column() {\n      TextInput({ controller: this.controller })\n      Button('\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e')\n        .onClick(() =&gt; {\n          this.controller.caretPosition(2)\n        })\n    }\n    .height('100%')\n    .backgroundColor(0xE6F2FD)\n  }\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"100\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/0260086000103404958.20221102115317.35282590037382074976290780085823.gif?resize=377%2C100&#038;ssl=1\" alt=\"\" class=\"wp-image-1709\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u83b7\u53d6\u8f93\u5165\u6587\u672c<\/h3>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u7ed9TextInput\u8bbe\u7f6eonChange\u4e8b\u4ef6\uff0c\u8f93\u5165\u6587\u672c\u53d1\u751f\u53d8\u5316\u65f6\u89e6\u53d1\u56de\u8c03\uff0c\u4e0b\u9762\u793a\u4f8b\u4ee3\u7801\u4e2d\u7684value\u4e3a\u5b9e\u65f6\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u6587\u672c\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TextInputDemo {\n  @State text: string = ''\n \n  build() {\n    Column() {\n      TextInput({ placeholder: '\u8bf7\u8f93\u5165\u8d26\u53f7' })\n        .caretColor(Color.Blue)\n        .onChange((value: string) =&gt; {\n          this.text = value\n        })\n      Text(this.text)\n    }\n    .alignItems(HorizontalAlign.Center)\n    .padding(12)\n    .backgroundColor(0xE6F2FD)\n  }\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"130\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/0260086000103404958.20221102115338.69547694354764992883763360730107.gif?resize=779%2C130&#038;ssl=1\" alt=\"\" class=\"wp-image-1710\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4.Button<\/h2>\n\n\n\n<p>Button\u7ec4\u4ef6\u4e3b\u8981\u7528\u6765\u54cd\u5e94\u70b9\u51fb\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5305\u542b\u5b50\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u6309\u94ae\u6837\u5f0f<\/h3>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528type\u6765\u6307\u5b9a\u6309\u94ae\u6837\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528ButtonType.Capsule\u6765\u6307\u5b9a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-10 wp-block-group-is-layout-flex\">\n<p>Capsule\uff1a\u80f6\u56ca\u578b\u6309\u94ae\uff08\u5706\u89d2\u9ed8\u8ba4\u4e3a\u9ad8\u5ea6\u7684\u4e00\u534a\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"184\" height=\"78\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-25.png?resize=184%2C78&#038;ssl=1\" alt=\"\" class=\"wp-image-1711\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Circle\uff1a\u5706\u5f62\u6309\u94ae\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"118\" height=\"114\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-26.png?resize=118%2C114&#038;ssl=1\" alt=\"\" class=\"wp-image-1712\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Normal\uff1a\u666e\u901a\u6309\u94ae\uff08\u9ed8\u8ba4\u4e0d\u5e26\u5706\u89d2\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"195\" height=\"86\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-27.png?resize=195%2C86&#038;ssl=1\" alt=\"\" class=\"wp-image-1713\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u6309\u94ae\u70b9\u51fb\u4e8b\u4ef6<\/h3>\n\n\n\n<p>\u53ef\u4ee5\u7ed9Button\u7ed1\u5b9aonClick\u4e8b\u4ef6\uff0c\u5f53\u7528\u6237\u70b9\u51fbButton\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u56de\u8c03onClick\u5185\u65b9\u6cd5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5305\u542b\u5b50\u7ec4\u4ef6<\/h3>\n\n\n\n<p>Button\u7ec4\u4ef6\u53ef\u4ee5\u5305\u542b\u5b50\u7ec4\u4ef6\uff0c\u8ba9\u60a8\u53ef\u4ee5\u5f00\u53d1\u51fa\u66f4\u4e30\u5bcc\u591a\u6837\u7684Button\uff0c\u4e0b\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u4e2dButton\u7ec4\u4ef6\u5305\u542b\u4e86\u4e00\u4e2aImage\u7ec4\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Button({ type: ButtonType.Circle, stateEffect: true }) {\n  Image($r('app.media.icon_delete'))\n    .width(30)\n    .height(30)\n}\n.width(55)\n.height(55)\n.backgroundColor(0x317aff)<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.LoadingProgress<\/h2>\n\n\n\n<p>LoadingProgress\u7ec4\u4ef6\u7528\u4e8e\u663e\u793a\u52a0\u8f7d\u8fdb\u5c55\uff0c\u6bd4\u5982\u5e94\u7528\u7684\u767b\u5f55\u754c\u9762\uff0c\u5f53\u6211\u4eec\u70b9\u51fb\u767b\u5f55\u7684\u65f6\u5019\uff0c\u663e\u793a\u7684\u201c\u6b63\u5728\u767b\u5f55\u201d\u7684\u8fdb\u5ea6\u6761\u72b6\u6001\u3002LoadingProgress\u7684\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u8bbe\u7f6e\u989c\u8272\u548c\u5bbd\u9ad8\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">LoadingProgress()\n  .color(Color.Blue)\n  .height(60)\n  .width(60)<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.\u4f7f\u7528\u8d44\u6e90\u5f15\u7528\u7c7b\u578b<\/h2>\n\n\n\n<p>Resource\u662f\u8d44\u6e90\u5f15\u7528\u7c7b\u578b\uff0c\u7528\u4e8e\u8bbe\u7f6e\u7ec4\u4ef6\u5c5e\u6027\u7684\u503c\u3002\u63a8\u8350\u5927\u5bb6\u4f18\u5148\u4f7f\u7528Resource\u7c7b\u578b\uff0c\u5c06\u8d44\u6e90\u6587\u4ef6\uff08\u5b57\u7b26\u4e32\u3001\u56fe\u7247\u3001\u97f3\u9891\u7b49\uff09\u7edf\u4e00\u5b58\u653e\u4e8eresources\u76ee\u5f55\u4e0b\uff0c\u4fbf\u4e8e\u5f00\u53d1\u8005\u7edf\u4e00\u7ef4\u62a4\u3002\u540c\u65f6\u7cfb\u7edf\u53ef\u4ee5\u6839\u636e\u5f53\u524d\u914d\u7f6e\u52a0\u8f7d\u5408\u9002\u7684\u8d44\u6e90\uff0c\u4f8b\u5982\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u5c4f\u5e55\u5c3a\u5bf8\u5448\u73b0\u4e0d\u540c\u7684\u5e03\u5c40\u6548\u679c\uff0c\u6216\u6839\u636e\u8bed\u8a00\u8bbe\u7f6e\u63d0\u4f9b\u4e0d\u540c\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p>\u5982\u4ee5\u4e0b\u4ee3\u7801\u6240\u6709\u503c\u90fd\u662f\u76f4\u63a5\u5199\u5728\u4ee3\u7801\u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Button('\u767b\u5f55', { type: ButtonType.Capsule, stateEffect: true })\n  .width(300)\n  .height(40)\n  .fontSize(16)\n  .fontWeight(FontWeight.Medium)\n  .backgroundColor('#007DFF')<\/code><\/pre>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5c06\u8fd9\u4e9b\u786c\u7f16\u7801\u5199\u5230entry\/src\/main\/resources\u4e0b\u7684\u8d44\u6e90\u6587\u4ef6\u4e2d\u3002<\/p>\n\n\n\n<p>\u7136\u540e\u5728Button\u7ec4\u4ef6\u901a\u8fc7\u201c$r(&#8216;app.type.name&#8217;)\u201d\u7684\u5f62\u5f0f\u5f15\u7528\u5e94\u7528\u8d44\u6e90\u3002app\u4ee3\u8868\u5e94\u7528\u5185resources\u76ee\u5f55\u4e2d\u5b9a\u4e49\u7684\u8d44\u6e90\uff1btype\u4ee3\u8868\u8d44\u6e90\u7c7b\u578b\uff08\u6216\u8d44\u6e90\u7684\u5b58\u653e\u4f4d\u7f6e\uff09\uff0c\u53ef\u4ee5\u53d6\u201ccolor\u201d\u3001\u201cfloat\u201d\u3001\u201cstring\u201d\u3001\u201cplural\u201d\u3001\u201cmedia\u201d\uff1bname\u4ee3\u8868\u8d44\u6e90\u547d\u540d\uff0c\u7531\u5f00\u53d1\u8005\u5b9a\u4e49\u8d44\u6e90\u65f6\u786e\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Button($r('app.string.login_text'), { type: ButtonType.Capsule })\n  .width($r('app.float.button_width'))\n  .height($r('app.float.button_height'))\n  .fontSize($r('app.float.login_fontSize'))\n  .backgroundColor($r('app.color.button_color'))<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Column\u548cRow\u7ec4\u4ef6<\/h2>\n\n\n\n<p>\u4e4b\u524d\u6211\u4eec\u804a\u8fc7Harmony\u7684\u4e24\u4e2a\u5e03\u5c40\u5bb9\u5668Column\u548cRow\uff0c\u5206\u522b\u8868\u793a\u5782\u76f4\u5e03\u5c40\u548c\u6c34\u5e73\u5e03\u5c40\u3002<\/p>\n\n\n\n<p>\u5176\u5b58\u5728\u4e24\u4e2a\u5e03\u5c40\u5c5e\u6027\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u5c5e\u6027\u540d\u79f0<\/th><th>\u63cf\u8ff0<\/th><\/tr><tr><td>justifyContent<\/td><td>\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u4e3b\u8f74\u65b9\u5411\u4e0a\u7684\u5bf9\u9f50\u683c\u5f0f\u3002<\/td><\/tr><tr><td>alignItems<\/td><td>\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u4ea4\u53c9\u8f74\u65b9\u5411\u4e0a\u7684\u5bf9\u9f50\u683c\u5f0f\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">justifyContent<\/h3>\n\n\n\n<p>\u5176\u53c2\u6570\u7c7b\u578b\u662f<a rel=\"noreferrer noopener\" href=\"https:\/\/developer.harmonyos.com\/cn\/docs\/documentation\/doc-references\/ts-appendix-enums-0000001281201130#ZH-CN_TOPIC_0000001281201130__flexalign\" target=\"_blank\">FlexAlign<\/a>\u3002FlexAlign\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u51e0\u79cd\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-11 wp-block-group-is-layout-flex\">\n<p>Start\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u9996\u7aef\u5bf9\u9f50\uff0c\u7b2c\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u9996\u5bf9\u9f50\uff0c\u540c\u65f6\u540e\u7eed\u7684\u5143\u7d20\u4e0e\u524d\u4e00\u4e2a\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-28.png?resize=1024%2C680&#038;ssl=1\" alt=\"\" class=\"wp-image-1714\" srcset=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-28.png?resize=1024%2C680&amp;ssl=1 1024w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-28.png?resize=300%2C199&amp;ssl=1 300w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-28.png?resize=768%2C510&amp;ssl=1 768w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-28.png?w=1057&amp;ssl=1 1057w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Center\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u4e2d\u5fc3\u5bf9\u9f50\uff0c\u7b2c\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u9996\u7684\u8ddd\u79bb\u4ee5\u53ca\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u5c3e\u8ddd\u79bb\u76f8\u540c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"687\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-29.png?resize=1024%2C687&#038;ssl=1\" alt=\"\" class=\"wp-image-1715\" srcset=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-29.png?resize=1024%2C687&amp;ssl=1 1024w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-29.png?resize=300%2C201&amp;ssl=1 300w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-29.png?resize=768%2C515&amp;ssl=1 768w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-29.png?w=1048&amp;ssl=1 1048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>End\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u5c3e\u90e8\u5bf9\u9f50\uff0c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u5c3e\u5bf9\u9f50\uff0c\u5176\u4ed6\u5143\u7d20\u4e0e\u540e\u4e00\u4e2a\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"672\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-30.png?resize=1024%2C672&#038;ssl=1\" alt=\"\" class=\"wp-image-1716\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-30.png?resize=1024%2C672&amp;ssl=1 1024w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-30.png?resize=300%2C197&amp;ssl=1 300w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-30.png?resize=768%2C504&amp;ssl=1 768w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-30.png?w=1057&amp;ssl=1 1057w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>SpaceBetween\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u5747\u5300\u5206\u914d\u5f39\u6027\u5143\u7d20\uff0c\u76f8\u90bb\u5143\u7d20\u4e4b\u95f4\u8ddd\u79bb\u76f8\u540c\u3002 \u7b2c\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u9996\u5bf9\u9f50\uff0c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e0e\u884c\u5c3e\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"689\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-31.png?resize=1024%2C689&#038;ssl=1\" alt=\"\" class=\"wp-image-1717\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-31.png?resize=1024%2C689&amp;ssl=1 1024w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-31.png?resize=300%2C202&amp;ssl=1 300w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-31.png?resize=768%2C517&amp;ssl=1 768w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-31.png?w=1049&amp;ssl=1 1049w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>SpaceAround\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u5747\u5300\u5206\u914d\u5f39\u6027\u5143\u7d20\uff0c\u76f8\u90bb\u5143\u7d20\u4e4b\u95f4\u8ddd\u79bb\u76f8\u540c\u3002 \u7b2c\u4e00\u4e2a\u5143\u7d20\u5230\u884c\u9996\u7684\u8ddd\u79bb\u548c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u5230\u884c\u5c3e\u7684\u8ddd\u79bb\u662f\u76f8\u90bb\u5143\u7d20\u4e4b\u95f4\u8ddd\u79bb\u7684\u4e00\u534a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-32.png?resize=1024%2C682&#038;ssl=1\" alt=\"\" class=\"wp-image-1718\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-32.png?resize=1024%2C682&amp;ssl=1 1024w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-32.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-32.png?resize=768%2C511&amp;ssl=1 768w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-32.png?w=1056&amp;ssl=1 1056w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>SpaceEvenly\uff1a\u5143\u7d20\u5728\u4e3b\u8f74\u65b9\u5411\u7b49\u95f4\u8ddd\u5e03\u5c40\uff0c\u65e0\u8bba\u662f\u76f8\u90bb\u5143\u7d20\u8fd8\u662f\u8fb9\u754c\u5143\u7d20\u5230\u5bb9\u5668\u7684\u95f4\u8ddd\u90fd\u4e00\u6837\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"671\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-33.png?resize=1024%2C671&#038;ssl=1\" alt=\"\" class=\"wp-image-1719\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-33.png?resize=1024%2C671&amp;ssl=1 1024w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-33.png?resize=300%2C197&amp;ssl=1 300w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-33.png?resize=768%2C503&amp;ssl=1 768w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-33.png?w=1045&amp;ssl=1 1045w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">alignItems<\/h3>\n\n\n\n<p>Column\u5bb9\u5668\u7684\u4e3b\u8f74\u662f\u5782\u76f4\u65b9\u5411\uff0c\u4ea4\u53c9\u8f74\u662f\u6c34\u5e73\u65b9\u5411\uff0c\u5176\u53c2\u6570\u7c7b\u578b\u4e3aHorizontalAlign\uff08\u6c34\u5e73\u5bf9\u9f50\uff09\uff0cHorizontalAlign\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u51e0\u79cd\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-12 wp-block-group-is-layout-flex\">\n<p>Start\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u6309\u7167\u8d77\u59cb\u7aef\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"600\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-34.png?resize=389%2C600&#038;ssl=1\" alt=\"\" class=\"wp-image-1720\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-34.png?w=389&amp;ssl=1 389w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-34.png?resize=195%2C300&amp;ssl=1 195w\" sizes=\"(max-width: 389px) 100vw, 389px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Center\uff08\u9ed8\u8ba4\u503c\uff09\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u5c45\u4e2d\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"602\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-35.png?resize=389%2C602&#038;ssl=1\" alt=\"\" class=\"wp-image-1721\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-35.png?w=389&amp;ssl=1 389w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-35.png?resize=194%2C300&amp;ssl=1 194w\" sizes=\"(max-width: 389px) 100vw, 389px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>End\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u6309\u7167\u672b\u7aef\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"390\" height=\"601\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-36.png?resize=390%2C601&#038;ssl=1\" alt=\"\" class=\"wp-image-1722\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-36.png?w=390&amp;ssl=1 390w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-36.png?resize=195%2C300&amp;ssl=1 195w\" sizes=\"(max-width: 390px) 100vw, 390px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p>Row\u5bb9\u5668\u7684\u4e3b\u8f74\u662f\u6c34\u5e73\u65b9\u5411\uff0c\u4ea4\u53c9\u8f74\u662f\u5782\u76f4\u65b9\u5411\uff0c\u5176\u53c2\u6570\u7c7b\u578b\u4e3aVerticalAlign\uff08\u5782\u76f4\u5bf9\u9f50\uff09\uff0cVerticalAlign\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u51e0\u79cd\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-13 wp-block-group-is-layout-flex\">\n<p>Top\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u5782\u76f4\u65b9\u5411\u4e0a\u5c45\u9876\u90e8\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"119\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-37.png?resize=248%2C119&#038;ssl=1\" alt=\"\" class=\"wp-image-1723\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Center\uff08\u9ed8\u8ba4\u503c\uff09\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u7ad6\u76f4\u65b9\u5411\u4e0a\u5c45\u4e2d\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"119\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-38.png?resize=252%2C119&#038;ssl=1\" alt=\"\" class=\"wp-image-1724\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p>Bottom\uff1a\u8bbe\u7f6e\u5b50\u7ec4\u4ef6\u5728\u7ad6\u76f4\u65b9\u5411\u4e0a\u5c45\u5e95\u90e8\u5bf9\u9f50\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"119\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-39.png?resize=252%2C119&#038;ssl=1\" alt=\"\" class=\"wp-image-1725\" data-recalc-dims=\"1\"\/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u63a5\u53e3<\/h3>\n\n\n\n<p>Column\u548cRow\u90fd\u5b58\u5728\u4ee5\u4e0b\u63a5\u53e3\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u5bb9\u5668\u7ec4\u4ef6<\/th><th>\u63a5\u53e3<\/th><\/tr><tr><td>Column<\/td><td>Column(value?:{space?: string | number})<\/td><\/tr><tr><td>Row<\/td><td>Row(value?:{space?: string | number})<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Column\u548cRow\u5bb9\u5668\u7684\u63a5\u53e3\u90fd\u6709\u4e00\u4e2a\u53ef\u9009\u53c2\u6570space\uff0c\u8868\u793a\u5b50\u7ec4\u4ef6\u5728\u4e3b\u8f74\u65b9\u5411\u4e0a\u7684\u95f4\u8ddd\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List\u548cGrid\u7ec4\u4ef6<\/h2>\n\n\n\n<p>List\u548cGrid\u4e5f\u662f\u4e00\u79cd\u5bb9\u5668\u7ec4\u4ef6\uff0c\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-40.png?resize=504%2C322&#038;ssl=1\" alt=\"\" class=\"wp-image-1727\" width=\"504\" height=\"322\" srcset=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-40.png?w=1008&amp;ssl=1 1008w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-40.png?resize=300%2C192&amp;ssl=1 300w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-40.png?resize=768%2C491&amp;ssl=1 768w\" sizes=\"(max-width: 504px) 100vw, 504px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">List\u7ec4\u4ef6<\/h3>\n\n\n\n<p>List\u662f\u5f88\u5e38\u7528\u7684\u6eda\u52a8\u7c7b\u5bb9\u5668\u7ec4\u4ef6\uff0c\u4e00\u822c\u548c\u5b50\u7ec4\u4ef6ListItem\u4e00\u8d77\u4f7f\u7528\uff0cList\u5217\u8868\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5217\u8868\u9879\u5bf9\u5e94\u4e00\u4e2aListItem\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"section108881326164919\">\u4f7f\u7528ForEach\u6e32\u67d3\u5217\u8868<\/h3>\n\n\n\n<p>\u5217\u8868\u5f80\u5f80\u7531\u591a\u4e2a\u5217\u8868\u9879\u7ec4\u6210\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5728List\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u591a\u4e2aListItem\u7ec4\u4ef6\u6765\u6784\u5efa\u5217\u8868\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4ee3\u7801\u7684\u5197\u4f59\u3002\u4f7f\u7528\u5faa\u73af\u6e32\u67d3\uff08ForEach\uff09\u904d\u5386\u6570\u7ec4\u7684\u65b9\u5f0f\u6784\u5efa\u5217\u8868\uff0c\u53ef\u4ee5\u51cf\u5c11\u91cd\u590d\u4ee3\u7801\uff0c\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct ListDemo {\n  private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n  build() {\n    Column() {\n      List({ space: 10 }) {\n        ForEach(this.arr, (item: number) =&gt; {\n          ListItem() {\n            Text(`${item}`)\n              .width('100%')\n              .height(100)\n              .fontSize(20)\n              .fontColor(Color.White)\n              .textAlign(TextAlign.Center)\n              .borderRadius(10)\n              .backgroundColor(0x007DFF)\n          }\n        }, item =&gt; item)\n      }\n    }\n    .padding(12)\n    .height('100%')\n    .backgroundColor(0xF1F3F5)\n  }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"section15586347504\">\u8bbe\u7f6e\u5217\u8868\u5206\u5272\u7ebf<\/h3>\n\n\n\n<p>List\u7ec4\u4ef6\u5b50\u7ec4\u4ef6ListItem\u4e4b\u95f4\u9ed8\u8ba4\u662f\u6ca1\u6709\u5206\u5272\u7ebf\u7684\uff0c\u90e8\u5206\u573a\u666f\u5b50\u7ec4\u4ef6ListItem\u95f4\u9700\u8981\u8bbe\u7f6e\u5206\u5272\u7ebf\uff0c\u8fd9\u65f6\u5019\u60a8\u53ef\u4ee5\u4f7f\u7528List\u7ec4\u4ef6\u7684divider\u5c5e\u6027\u3002divider\u5c5e\u6027\u5305\u542b\u56db\u4e2a\u53c2\u6570\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>strokeWidth: \u5206\u5272\u7ebf\u7684\u7ebf\u5bbd\u3002<\/li>\n\n\n\n<li>color: \u5206\u5272\u7ebf\u7684\u989c\u8272\u3002<\/li>\n\n\n\n<li>startMargin\uff1a\u5206\u5272\u7ebf\u8ddd\u79bb\u5217\u8868\u4fa7\u8fb9\u8d77\u59cb\u7aef\u7684\u8ddd\u79bb\u3002<\/li>\n\n\n\n<li>endMargin: \u5206\u5272\u7ebf\u8ddd\u79bb\u5217\u8868\u4fa7\u8fb9\u7ed3\u675f\u7aef\u7684\u8ddd\u79bb\u3002<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-14 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-41.png?resize=234%2C270&#038;ssl=1\" alt=\"\" class=\"wp-image-1728\" width=\"234\" height=\"270\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-41.png?w=467&amp;ssl=1 467w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-41.png?resize=260%2C300&amp;ssl=1 260w\" sizes=\"(max-width: 234px) 100vw, 234px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"section11541627155010\">List\u5217\u8868\u6eda\u52a8\u4e8b\u4ef6\u76d1\u542c<\/h3>\n\n\n\n<p>List\u7ec4\u4ef6\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u4e8b\u4ef6\u65b9\u6cd5\u7528\u6765\u76d1\u542c\u5217\u8868\u7684\u6eda\u52a8\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\uff0c\u76d1\u542c\u8fd9\u4e9b\u4e8b\u4ef6\u6765\u505a\u4e00\u4e9b\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>onScroll\uff1a\u5217\u8868\u6ed1\u52a8\u65f6\u89e6\u53d1\uff0c\u8fd4\u56de\u503cscrollOffset\u4e3a\u6ed1\u52a8\u504f\u79fb\u91cf\uff0cscrollState\u4e3a\u5f53\u524d\u6ed1\u52a8\u72b6\u6001\u3002<\/li>\n\n\n\n<li>onScrollIndex\uff1a\u5217\u8868\u6ed1\u52a8\u65f6\u89e6\u53d1\uff0c\u8fd4\u56de\u503c\u5206\u522b\u4e3a\u6ed1\u52a8\u8d77\u59cb\u4f4d\u7f6e\u7d22\u5f15\u503c\u4e0e\u6ed1\u52a8\u7ed3\u675f\u4f4d\u7f6e\u7d22\u5f15\u503c\u3002<\/li>\n\n\n\n<li>onReachStart\uff1a\u5217\u8868\u5230\u8fbe\u8d77\u59cb\u4f4d\u7f6e\u65f6\u89e6\u53d1\u3002<\/li>\n\n\n\n<li>onReachEnd\uff1a\u5217\u8868\u5230\u5e95\u672b\u5c3e\u4f4d\u7f6e\u65f6\u89e6\u53d1\u3002<\/li>\n\n\n\n<li>onScrollStop\uff1a\u5217\u8868\u6ed1\u52a8\u505c\u6b62\u65f6\u89e6\u53d1\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">List({ space: 10 }) {\n  ForEach(this.arr, (item) =&gt; {\n    ListItem() {\n      Text(`${item}`)\n        ...\n    }\n  }, item =&gt; item)\n}\n.onScrollIndex((firstIndex: number, lastIndex: number) =&gt; {\n  console.info('first' + firstIndex)\n  console.info('last' + lastIndex)\n})\n.onScroll((scrollOffset: number, scrollState: ScrollState) =&gt; {\n  console.info('scrollOffset' + scrollOffset)\n  console.info('scrollState' + scrollState)\n})\n.onReachStart(() =&gt; {\n  console.info('onReachStart')\n})\n.onReachEnd(() =&gt; {\n  console.info('onReachEnd')\n})\n.onScrollStop(() =&gt; {\n  console.info('onScrollStop')\n})<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"section14583648145012\">\u8bbe\u7f6eList\u6392\u5217\u65b9\u5411<\/h3>\n\n\n\n<p>List\u7ec4\u4ef6\u91cc\u9762\u7684\u5217\u8868\u9879\u9ed8\u8ba4\u662f\u6309\u5782\u76f4\u65b9\u5411\u6392\u5217\u7684\uff0c\u5982\u679c\u60a8\u60f3\u8ba9\u5217\u8868\u6cbf\u6c34\u5e73\u65b9\u5411\u6392\u5217\uff0c\u60a8\u53ef\u4ee5\u5c06List\u7ec4\u4ef6\u7684listDirection\u5c5e\u6027\u8bbe\u7f6e\u4e3aAxis.Horizontal\u3002<\/p>\n\n\n\n<p>listDirection\u53c2\u6570\u7c7b\u578b\u662f<a rel=\"noreferrer noopener\" href=\"https:\/\/developer.harmonyos.com\/cn\/docs\/documentation\/doc-references-V3\/ts-appendix-enums-0000001478061741-V3?catalogVersion=V3#ZH-CN_TOPIC_0000001478061741__axis\" target=\"_blank\">Axis<\/a>\uff0c\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u4e24\u79cd\u7c7b\u578b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-15 wp-block-group-is-layout-flex\">\n<p>Vertical\uff08\u9ed8\u8ba4\u503c\uff09\uff1a\u5b50\u7ec4\u4ef6ListItem\u5728List\u5bb9\u5668\u7ec4\u4ef6\u4e2d\u5448\u7eb5\u5411\u6392\u5217\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"399\" height=\"475\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-42.png?resize=399%2C475&#038;ssl=1\" alt=\"\" class=\"wp-image-1729\" srcset=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-42.png?w=399&amp;ssl=1 399w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-42.png?resize=252%2C300&amp;ssl=1 252w\" sizes=\"(max-width: 399px) 100vw, 399px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Horizontal\uff1a\u5b50\u7ec4\u4ef6ListItem\u5728List\u5bb9\u5668\u7ec4\u4ef6\u4e2d\u5448\u6a2a\u5411\u6392\u5217\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"242\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-43.png?resize=537%2C242&#038;ssl=1\" alt=\"\" class=\"wp-image-1730\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-43.png?w=537&amp;ssl=1 537w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-43.png?resize=300%2C135&amp;ssl=1 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Grid\u7ec4\u4ef6<\/h3>\n\n\n\n<p>Grid\u7ec4\u4ef6\u4e3a\u7f51\u683c\u5bb9\u5668\uff0c\u662f\u4e00\u79cd\u7f51\u683c\u5217\u8868\uff0c\u7531\u201c\u884c\u201d\u548c\u201c\u5217\u201d\u5206\u5272\u7684\u5355\u5143\u683c\u6240\u7ec4\u6210\uff0c\u901a\u8fc7\u6307\u5b9a\u201c\u9879\u76ee\u201d\u6240\u5728\u7684\u5355\u5143\u683c\u505a\u51fa\u5404\u79cd\u5404\u6837\u7684\u5e03\u5c40\u3002Grid\u7ec4\u4ef6\u4e00\u822c\u548c\u5b50\u7ec4\u4ef6GridItem\u4e00\u8d77\u4f7f\u7528\uff0cGrid\u5217\u8868\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6761\u76ee\u5bf9\u5e94\u4e00\u4e2aGridItem\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u7528ForEach\u6e32\u67d3\u7f51\u683c\u5e03\u5c40<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct GridExample {\n  \/\/ \u5b9a\u4e49\u4e00\u4e2a\u957f\u5ea6\u4e3a16\u7684\u6570\u7ec4\n  private arr: string[] = new Array(16).fill('').map((_, index) =&gt; `item ${index}`);\n\n  build() {\n    Column() {\n      Grid() {\n        ForEach(this.arr, (item: string) =&gt; {\n          GridItem() {\n            Text(item)\n              .fontSize(16)\n              .fontColor(Color.White)\n              .backgroundColor(0x007DFF)\n              .width('100%')\n              .height('100%')\n              .textAlign(TextAlign.Center)\n          }\n        }, item =&gt; item)\n      }\n      .columnsTemplate('1fr 1fr 1fr 1fr')\n      .rowsTemplate('1fr 1fr 1fr 1fr')\n      .columnsGap(10)\n      .rowsGap(10)\n      .height(300)\n    }\n    .width('100%')\n    .padding(12)\n    .backgroundColor(0xF1F3F5)\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u793a\u4f8b\u4ee3\u7801\u4e2d\u521b\u5efa\u4e8616\u4e2aGridItem\u5217\u8868\u9879\u3002\u540c\u65f6\u8bbe\u7f6ecolumnsTemplate\u7684\u503c\u4e3a&#8217;1fr 1fr 1fr 1fr&#8217;\uff0c\u8868\u793a\u8fd9\u4e2a\u7f51\u683c\u4e3a4\u5217\uff0c\u5c06Grid\u5141\u8bb8\u7684\u5bbd\u5206\u4e3a4\u7b49\u5206\uff0c\u6bcf\u5217\u53601\u4efd\uff1browsTemplate\u7684\u503c\u4e3a&#8217;1fr 1fr 1fr 1fr&#8217;\uff0c\u8868\u793a\u8fd9\u4e2a\u7f51\u683c\u4e3a4\u884c\uff0c\u5c06Grid\u5141\u8bb8\u7684\u9ad8\u5206\u4e3a4\u7b49\u5206\uff0c\u6bcf\u884c\u53601\u4efd\u3002\u8fd9\u6837\u5c31\u6784\u6210\u4e86\u4e00\u4e2a4\u884c4\u5217\u7684\u7f51\u683c\u5217\u8868\uff0c\u7136\u540e\u4f7f\u7528columnsGap\u8bbe\u7f6e\u5217\u95f4\u8ddd\u4e3a10vp\uff0c\u4f7f\u7528rowsGap\u8bbe\u7f6e\u884c\u95f4\u8ddd\u4e5f\u4e3a10vp\u3002\u793a\u4f8b\u4ee3\u7801\u6548\u679c\u56fe\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>\u4e0a\u9762\u6784\u5efa\u7684\u7f51\u683c\u5e03\u5c40\u4f7f\u7528\u4e86\u56fa\u5b9a\u7684\u884c\u6570\u548c\u5217\u6570\uff0c\u6240\u4ee5\u6784\u5efa\u51fa\u7684\u7f51\u683c\u662f\u4e0d\u53ef\u6eda\u52a8\u7684\u3002\u7136\u800c\u6709\u65f6\u5019\u56e0\u4e3a\u5185\u5bb9\u8f83\u591a\uff0c\u6211\u4eec\u901a\u8fc7\u6eda\u52a8\u7684\u65b9\u5f0f\u6765\u663e\u793a\u66f4\u591a\u7684\u5185\u5bb9\uff0c\u5c31\u9700\u8981\u4e00\u4e2a\u53ef\u4ee5\u6eda\u52a8\u7684\u7f51\u683c\u5e03\u5c40\u3002\u6211\u4eec\u53ea\u9700\u8981\u8bbe\u7f6erowsTemplate\u548ccolumnsTemplate\u4e2d\u7684\u4e00\u4e2a\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u5c06\u793a\u4f8b\u4ee3\u7801\u4e2dGridItem\u7684\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a\u56fa\u5b9a\u503c\uff0c\u4f8b\u5982100\uff1b\u4ec5\u8bbe\u7f6ecolumnsTemplate\u5c5e\u6027\uff0c\u4e0d\u8bbe\u7f6erowsTemplate\u5c5e\u6027\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0Grid\u5217\u8868\u7684\u6eda\u52a8\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Grid() {\n  ForEach(this.arr, (item: string) =&gt; {\n    GridItem() {\n      Text(item)\n        .height(100)\n        ...\n    }\n  }, item =&gt; item)\n}\n.columnsTemplate('1fr 1fr 1fr 1fr')\n.columnsGap(10)\n.rowsGap(10)\n.height(300)<\/code><\/pre>\n\n\n\n<p>\u6b64\u5916\uff0cGrid\u50cfList\u4e00\u6837\u4e5f\u53ef\u4ee5\u4f7f\u7528onScrollIndex\u6765\u76d1\u542c\u5217\u8868\u7684\u6eda\u52a8\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tabs\u7ec4\u4ef6<\/h2>\n\n\n\n<p>\u5728\u6211\u4eec\u5e38\u7528\u7684\u5e94\u7528\u4e2d\uff0c\u7ecf\u5e38\u4f1a\u6709\u89c6\u56fe\u5185\u5bb9\u5207\u6362\u7684\u573a\u666f\uff0c\u6765\u5c55\u793a\u66f4\u52a0\u4e30\u5bcc\u7684\u5185\u5bb9\u3002\u6bd4\u5982\u4e0b\u9762\u8fd9\u4e2a\u9875\u9762\uff0c\u70b9\u51fb\u5e95\u90e8\u7684\u9875\u7b7e\u7684\u9009\u9879\uff0c\u53ef\u4ee5\u5b9e\u73b0\u201c\u9996\u9875\u201d\u548c\u201c\u6211\u7684\u201d<\/p>\n\n\n\n<p>\u4e24\u4e2a\u5185\u5bb9\u89c6\u56fe\u7684\u5207\u6362\u3002<\/p>\n\n\n\n<p>ArkUI\u5f00\u53d1\u6846\u67b6\u63d0\u4f9b\u4e86\u4e00\u79cd\u9875\u7b7e\u5bb9\u5668\u7ec4\u4ef6Tabs\uff0c\u5f00\u53d1\u8005\u901a\u8fc7Tabs\u7ec4\u4ef6\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u5b9e\u73b0\u5185\u5bb9\u89c6\u56fe\u7684\u5207\u6362\u3002\u9875\u7b7e\u5bb9\u5668Tabs\u7684\u5f62\u5f0f\u591a\u79cd\u591a\u6837\uff0c\u4e0d\u540c\u7684\u9875\u9762\u8bbe\u8ba1\u9875\u7b7e\u4e0d\u4e00\u6837\uff0c\u53ef\u4ee5\u628a\u9875\u7b7e\u8bbe\u7f6e\u5728\u5e95\u90e8\u3001\u9876\u90e8\u6216\u8005\u4fa7\u8fb9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TabsExample {\n  private controller: TabsController = new TabsController()\n\n  build() {\n    Column() {\n      Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {\n        TabContent() {\n          Column().width('100%').height('100%').backgroundColor(Color.Green)\n        }\n        .tabBar('green')\n\n        TabContent() {\n          Column().width('100%').height('100%').backgroundColor(Color.Blue)\n        }\n        .tabBar('blue')\n\n        TabContent() {\n          Column().width('100%').height('100%').backgroundColor(Color.Yellow)\n        }\n        .tabBar('yellow')\n\n        TabContent() {\n          Column().width('100%').height('100%').backgroundColor(Color.Pink)\n        }\n        .tabBar('pink')\n      }\n      .barWidth('100%') \/\/ \u8bbe\u7f6eTabBar\u5bbd\u5ea6\n      .barHeight(60) \/\/ \u8bbe\u7f6eTabBar\u9ad8\u5ea6\n      .width('100%') \/\/ \u8bbe\u7f6eTabs\u7ec4\u4ef6\u5bbd\u5ea6\n      .height('100%') \/\/ \u8bbe\u7f6eTabs\u7ec4\u4ef6\u9ad8\u5ea6\n      .backgroundColor(0xF5F5F5) \/\/ \u8bbe\u7f6eTabs\u7ec4\u4ef6\u80cc\u666f\u989c\u8272\n    }\n    .width('100%')\n    .height('100%')\n  }\n}<\/code><\/pre>\n\n\n\n<p>Tabs\u7ec4\u4ef6\u4e2d\u5305\u542b4\u4e2a\u5b50\u7ec4\u4ef6TabContent\uff0c\u901a\u8fc7TabContent\u7684tabBar\u5c5e\u6027\u8bbe\u7f6eTabBar\u7684\u663e\u793a\u5185\u5bb9\u3002\u4f7f\u7528\u901a\u7528\u5c5e\u6027width\u548cheight\u8bbe\u7f6e\u4e86Tabs\u7ec4\u4ef6\u7684\u5bbd\u9ad8\uff0c\u4f7f\u7528barWidth\u548cbarHeight\u8bbe\u7f6e\u4e86TabBar\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-44.png?resize=512%2C120&#038;ssl=1\" alt=\"\" class=\"wp-image-1731\" width=\"512\" height=\"120\" srcset=\"https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-44.png?resize=1024%2C239&amp;ssl=1 1024w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-44.png?resize=300%2C70&amp;ssl=1 300w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-44.png?resize=768%2C179&amp;ssl=1 768w, https:\/\/i1.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-44.png?w=1030&amp;ssl=1 1030w\" sizes=\"(max-width: 512px) 100vw, 512px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li>TabContent\u7ec4\u4ef6\u4e0d\u652f\u6301\u8bbe\u7f6e\u901a\u7528\u5bbd\u5ea6\u5c5e\u6027\uff0c\u5176\u5bbd\u5ea6\u9ed8\u8ba4\u6491\u6ee1Tabs\u7236\u7ec4\u4ef6\u3002<\/li>\n\n\n\n<li>TabContent\u7ec4\u4ef6\u4e0d\u652f\u6301\u8bbe\u7f6e\u901a\u7528\u9ad8\u5ea6\u5c5e\u6027\uff0c\u5176\u9ad8\u5ea6\u7531Tabs\u7236\u7ec4\u4ef6\u9ad8\u5ea6\u4e0eTabBar\u7ec4\u4ef6\u9ad8\u5ea6\u51b3\u5b9a\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6eTabBar\u5e03\u5c40\u6a21\u5f0f<\/h3>\n\n\n\n<p>\u56e0\u4e3aTabs\u7684\u5e03\u5c40\u6a21\u5f0f\u9ed8\u8ba4\u662fFixed\u7684\uff0c\u6240\u4ee5Tabs\u7684\u9875\u7b7e\u662f\u4e0d\u53ef\u6ed1\u52a8\u7684\u3002\u5f53\u9875\u7b7e\u6bd4\u8f83\u591a\u7684\u65f6\u5019\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u9875\u7b7e\u663e\u793a\u4e0d\u5168\uff0c\u5c06\u5e03\u5c40\u6a21\u5f0f\u8bbe\u7f6e\u4e3aScrollable\u7684\u8bdd\uff0c\u53ef\u4ee5\u5b9e\u73b0\u9875\u7b7e\u7684\u6eda\u52a8\u3002<\/p>\n\n\n\n<p>Tabs\u7684\u5e03\u5c40\u6a21\u5f0f\u6709Fixed\uff08\u9ed8\u8ba4\uff09\u548cScrollable\u4e24\u79cd\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>BarMode.Fixed\uff1a\u6240\u6709TabBar\u5e73\u5747\u5206\u914dbarWidth\u5bbd\u5ea6\uff08\u7eb5\u5411\u65f6\u5e73\u5747\u5206\u914dbarHeight\u9ad8\u5ea6\uff09,\u9875\u7b7e\u4e0d\u53ef\u6eda\u52a8\uff0c\u6548\u679c\u56fe\u5982\u4e0b\uff1a<\/li>\n\n\n\n<li><img decoding=\"async\" height=\"51 .24037800000001\" width=\"382 .0425\" src=\"https:\/\/i2.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/011\/111\/111\/0000000000011111111.20240320115207.67583945504794807637886704265594:50001231000000:2800:59B7153CC584CD8CD9D43189333AA36E0AF85C9B1670493E4E18386F1053DDBA.png?resize=382%2C51&#038;ssl=1\" data-recalc-dims=\"1\"><\/li>\n\n\n\n<li>BarMode.Scrollable\uff1a\u6bcf\u4e00\u4e2aTabBar\u5747\u4f7f\u7528\u5b9e\u9645\u5e03\u5c40\u5bbd\u5ea6\uff0c\u8d85\u8fc7\u603b\u957f\u5ea6\uff08\u6a2a\u5411Tabs\u7684barWidth\uff0c\u7eb5\u5411Tabs\u7684barHeight\uff09\u540e\u53ef\u6ed1\u52a8\u3002<\/li>\n\n\n\n<li><img decoding=\"async\" height=\"51 .90936800000001\" width=\"387 .03000000000003\" src=\"https:\/\/i0.wp.com\/alliance-communityfile-drcn.dbankcdn.com\/FileServer\/getFile\/cmtyPub\/011\/111\/111\/0000000000011111111.20240320115207.44785962514570319751042566978055:50001231000000:2800:5B436993319E7EE9CE2949EDF6C343E0293C9BD3EEB7B50ED6EF03BF8EC58488.png?resize=387%2C51&#038;ssl=1\" data-recalc-dims=\"1\"><\/li>\n<\/ul>\n\n\n\n<p>\u5f53\u9875\u7b7e\u6bd4\u8f83\u591a\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u6ed1\u52a8\u9875\u7b7e\uff0c\u4e0b\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u5c06barMode\u8bbe\u7f6e\u4e3aBarMode.Scrollable\uff0c\u5b9e\u73b0\u4e86\u53ef\u6eda\u52a8\u7684\u9875\u7b7e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TabsExample {\n  private controller: TabsController = new TabsController()\n\n  build() {\n    Column() {\n      Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {\n        TabContent() {\n          Column()\n            .width('100%')\n            .height('100%')\n            .backgroundColor(Color.Green)\n        }\n        .tabBar('green')\n\n        TabContent() {\n          Column()\n            .width('100%')\n            .height('100%')\n            .backgroundColor(Color.Blue)\n        }\n        .tabBar('blue')\n\n        ...\n\n      }\n      .barMode(BarMode.Scrollable)\n      .barWidth('100%')\n      .barHeight(60)\n      .width('100%')\n      .height('100%')\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"section1737793818463\">\u8bbe\u7f6eTabBar\u4f4d\u7f6e\u548c\u6392\u5217\u65b9\u5411<\/h3>\n\n\n\n<p>Tabs\u7ec4\u4ef6\u9875\u7b7e\u9ed8\u8ba4\u663e\u793a\u5728\u9876\u90e8\uff0c\u67d0\u4e9b\u573a\u666f\u4e0b\u60a8\u53ef\u80fd\u5e0c\u671bTabs\u9875\u7b7e\u51fa\u73b0\u5728\u5e95\u90e8\u6216\u8005\u4fa7\u8fb9\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Tabs\u7ec4\u4ef6\u63a5\u53e3\u4e2d\u7684\u53c2\u6570barPosition\u8bbe\u7f6e\u9875\u7b7e\u4f4d\u7f6e\u3002\u6b64\u5916\u9875\u7b7e\u663e\u793a\u4f4d\u7f6e\u8fd8\u4e0evertical\u5c5e\u6027\u76f8\u5173\u8054\uff0cvertical\u5c5e\u6027\u7528\u4e8e\u8bbe\u7f6e\u9875\u7b7e\u7684\u6392\u5217\u65b9\u5411\uff0c\u5f53vertical\u7684\u5c5e\u6027\u503c\u4e3afalse\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\u9875\u7b7e\u6a2a\u5411\u6392\u5217\uff0c\u4e3atrue\u65f6\u9875\u7b7e\u7eb5\u5411\u6392\u5217\u3002<\/p>\n\n\n\n<p>barPosition\u7684\u503c\u53ef\u4ee5\u8bbe\u7f6e\u4e3aBarPosition.Start\uff08\u9ed8\u8ba4\u503c\uff09\u548cBarPosition.End\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>BarPosition.Startvertical\u5c5e\u6027\u65b9\u6cd5\u8bbe\u7f6e\u4e3afalse\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u9875\u7b7e\u4f4d\u4e8e\u5bb9\u5668\u9876\u90e8\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Tabs({ barPosition: BarPosition.Start }) {\n  ...\n}\n.vertical(false) \n.barWidth('100%') \n.barHeight(60)  <\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-16 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-45.png?resize=181%2C361&#038;ssl=1\" alt=\"\" class=\"wp-image-1733\" width=\"181\" height=\"361\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-45.png?w=361&amp;ssl=1 361w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-45.png?resize=150%2C300&amp;ssl=1 150w\" sizes=\"(max-width: 181px) 100vw, 181px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p>vertical\u5c5e\u6027\u65b9\u6cd5\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u9875\u7b7e\u4f4d\u4e8e\u5bb9\u5668\u5de6\u4fa7\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Tabs({ barPosition: BarPosition.Start }) {  \n...\n}\n.vertical(true) \n.barWidth(100) \n.barHeight(200)  <\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-17 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-46.png?resize=179%2C362&#038;ssl=1\" alt=\"\" class=\"wp-image-1734\" width=\"179\" height=\"362\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-46.png?w=357&amp;ssl=1 357w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-46.png?resize=148%2C300&amp;ssl=1 148w\" sizes=\"(max-width: 179px) 100vw, 179px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p>BarPosition.End<\/p>\n\n\n\n<p>vertical\u5c5e\u6027\u65b9\u6cd5\u8bbe\u7f6e\u4e3afalse\u65f6\uff0c\u9875\u7b7e\u4f4d\u4e8e\u5bb9\u5668\u5e95\u90e8\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">Tabs({ barPosition: BarPosition.End }) {\n  ...\n}\n.vertical(false) \n.barWidth('100%') \n.barHeight(60)<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-18 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-47.png?resize=178%2C360&#038;ssl=1\" alt=\"\" class=\"wp-image-1735\" width=\"178\" height=\"360\" srcset=\"https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-47.png?w=356&amp;ssl=1 356w, https:\/\/i0.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-47.png?resize=148%2C300&amp;ssl=1 148w\" sizes=\"(max-width: 178px) 100vw, 178px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p>vertical\u5c5e\u6027\u65b9\u6cd5\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u9875\u7b7e\u4f4d\u4e8e\u5bb9\u5668\u53f3\u4fa7\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">Tabs({ barPosition: BarPosition.End}) {\n  ...\n}\n.vertical(true) \n.barWidth(100) \n.barHeight(200)<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-19 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-48.png?resize=181%2C360&#038;ssl=1\" alt=\"\" class=\"wp-image-1736\" width=\"181\" height=\"360\" srcset=\"https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-48.png?w=362&amp;ssl=1 362w, https:\/\/i2.wp.com\/fireinsect.top\/wp-content\/uploads\/2024\/03\/image-48.png?resize=151%2C300&amp;ssl=1 151w\" sizes=\"(max-width: 181px) 100vw, 181px\" data-recalc-dims=\"1\" \/><\/figure>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u81ea\u5b9a\u4e49TabBar\u6837\u5f0f<\/h3>\n\n\n\n<p>TabContent\u7684tabBar\u5c5e\u6027\u9664\u4e86\u652f\u6301string\u7c7b\u578b\uff0c\u8fd8\u652f\u6301\u4f7f\u7528@Builder\u88c5\u9970\u5668\u4fee\u9970\u7684\u51fd\u6570\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528@Builder\u88c5\u9970\u5668\uff0c\u6784\u9020\u4e00\u4e2a\u751f\u6210\u81ea\u5b9a\u4e49TabBar\u6837\u5f0f\u7684\u51fd\u6570\uff0c\u5b9e\u73b0\u4e0a\u9762\u7684\u5e95\u90e8\u9875\u7b7e\u6548\u679c\uff0c\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"typescript\" class=\"language-typescript\">@Entry\n@Component\nstruct TabsExample {\n  @State currentIndex: number = 0;\n  private tabsController: TabsController = new TabsController();\n\n  @Builder TabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {\n    Column() {\n      Image(this.currentIndex === targetIndex ? selectedImg : normalImg)\n        .size({ width: 25, height: 25 })\n      Text(title)\n        .fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B')\n    }\n    .width('100%')\n    .height(50)\n    .justifyContent(FlexAlign.Center)\n    .onClick(() =&gt; {\n      this.currentIndex = targetIndex;\n      this.tabsController.changeIndex(this.currentIndex);\n    })\n  }\n\n  build() {\n    Tabs({ barPosition: BarPosition.End, controller: this.tabsController }) {\n      TabContent() {\n        Column().width('100%').height('100%').backgroundColor('#00CB87')\n      }\n      .tabBar(this.TabBuilder('\u9996\u9875', 0, $r('app.media.home_selected'), $r('app.media.home_normal')))\n\n      TabContent() {\n        Column().width('100%').height('100%').backgroundColor('#007DFF')\n      }\n      .tabBar(this.TabBuilder('\u6211\u7684', 1, $r('app.media.mine_selected'), $r('app.media.mine_normal')))\n    }\n    .barWidth('100%')\n    .barHeight(50)\n    .onChange((index: number) =&gt; {\n      this.currentIndex = index;\n    })\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7ed9Tabs\u7ec4\u4ef6\u8bbe\u7f6e\u4e86TabsController\u63a7\u5236\u5668\uff0c\u5f53\u70b9\u51fb\u67d0\u4e2a\u9875\u7b7e\u65f6\uff0c\u8c03\u7528changeIndex\u65b9\u6cd5\u8fdb\u884c\u9875\u7b7e\u5185\u5bb9\u5207\u6362\u3002\u8fd8\u7ed9Tabs\u6dfb\u52a0onChange\u4e8b\u4ef6\uff0cTab\u9875\u7b7e\u5207\u6362\u540e\u89e6\u53d1\u8be5\u4e8b\u4ef6\uff0c\u8fd9\u6837\u5f53\u6211\u4eec\u5de6\u53f3\u6ed1\u52a8\u5185\u5bb9\u89c6\u56fe\u7684\u65f6\u5019\uff0c\u9875\u7b7e\u6837\u5f0f\u4e5f\u4f1a\u8ddf\u7740\u6539\u53d8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[1,16],"tags":[],"class_list":["post-1693","post","type-post","status-publish","format-standard","hentry","category-wcd","category-16"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/posts\/1693"}],"collection":[{"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/comments?post=1693"}],"version-history":[{"count":11,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/posts\/1693\/revisions"}],"predecessor-version":[{"id":1740,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/posts\/1693\/revisions\/1740"}],"wp:attachment":[{"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/media?parent=1693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/categories?post=1693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fireinsect.top\/index.php\/wp-json\/wp\/v2\/tags?post=1693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}