{"id":185437,"date":"2023-09-22T05:18:50","date_gmt":"2023-09-21T21:18:50","guid":{"rendered":"http:\/\/www.idc.net\/help\/185437\/"},"modified":"2023-09-22T05:18:50","modified_gmt":"2023-09-21T21:18:50","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%95%99%e7%a8%8b%ef%bc%9a%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f-weui%c2%b7%e5%af%bc%e8%88%aa%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/185437\/","title":{"rendered":"\u540e\u6d6a\u4e91\u5c0f\u7a0b\u5e8f\u6559\u7a0b\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f WeUI\u00b7\u5bfc\u822a\u7ec4\u4ef6"},"content":{"rendered":"<h2>Navigation<\/h2>\n<p>Navigation\u662f\u5c0f\u7a0b\u5e8f\u7684\u9876\u90e8\u5bfc\u822a\u7ec4\u4ef6\uff0c\u5f53\u9875\u9762\u914d\u7f6enavigationStyle\u8bbe\u7f6e\u4e3acustom\u7684\u65f6\u5019\u53ef\u4ee5\u4f7f\u7528\u6b64\u7ec4\u4ef6\u66ff\u4ee3\u539f\u751f\u5bfc\u822a\u680f\u3002<\/p>\n<h2>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h2>\n<pre><code>{\n    \"usingComponents\": {\n        \"mp-navigation-bar\": \"..\/components\/navigation-bar\/navigation-bar\"\n    },\n    \"navigationStyle\": \"custom\",\n    \"navigationBarTitleText\": \"UI\u7ec4\u4ef6\u5e93\"\n}<\/code><\/pre>\n<h2>\n<pre><code>&lt;mp-navigation-bar loading=\"{{loading}}\" show=\"{{show}}\" animated=\"{{animated}}\" color=\"{{color}}\" background=\"{{background}}\" title=\"UI\u7ec4\u4ef6\u5e93\" back=\"{{true}}\"&gt;&lt;\/mp-navigation-bar&gt;\n&lt;view class=\"page\"&gt;\n    &lt;view class=\"page__hd\"&gt;\n        &lt;view class=\"page__title\"&gt;Navigation&lt;\/view&gt;\n        &lt;view class=\"page__desc\"&gt;\u5c0f\u7a0b\u5e8f\u81ea\u5b9a\u4e49\u5bfc\u822a\u680f&lt;\/view&gt;\n    &lt;\/view&gt;\n    &lt;view class=\"page__bd page__bd_spacing\"&gt;\n        &lt;button class=\"weui-btn\" type=\"primary\" bindtap=\"toggleLoading\"&gt;\u89e6\u53d1loading&lt;\/button&gt;\n        &lt;button class=\"weui-btn\" type=\"primary\" bindtap=\"changeColor\"&gt;\u4fee\u6539\u6587\u5b57\u989c\u8272&lt;\/button&gt;\n        &lt;button class=\"weui-btn\" type=\"primary\" bindtap=\"changeBgColor\"&gt;\u4fee\u6539\u80cc\u666f\u989c\u8272&lt;\/button&gt;\n        &lt;button class=\"weui-btn\" type=\"primary\" bindtap=\"toggleShow\"&gt;\u663e\u793a \/ \u9690\u85cf&lt;\/button&gt;\n        &lt;button class=\"weui-btn\" type=\"primary\" bindtap=\"toggleAnimated\"&gt;\u8bbe\u7f6e\u663e\u793a \/ \u9690\u85cfopacity\u52a8\u753b&lt;\/button&gt;\n    &lt;\/view&gt;\n&lt;\/view&gt;<\/code><\/pre>\n<\/h2>\n<h2>\n<pre><code>Page({\n  data: {\n    loading: false,\n    color: '#000',\n    background: '#f8f8f8',\n    show: true,\n    animated: false\n  },\n  toggleLoading() {\n    this.setData({\n      loading: !this.data.loading\n    })\n  },\n  changeColor() {\n    this.setData({\n      color: '#07C160'\n    })\n  },\n  changeBgColor() {\n    this.setData({\n      background: '#ededed'\n    })\n  },\n  toggleShow() {\n    this.setData({\n      show: !this.data.show\n    })\n  },\n  toggleAnimated() {\n    this.setData({\n      animated: !this.data.animated,\n      show: !this.data.show\n    })\n  }\n})<\/code><\/pre>\n<\/h2>\n<h2><\/h2>\n<h2>\u5c5e\u6027\u5217\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ext-class<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u6dfb\u52a0\u5728\u7ec4\u4ef6\u5185\u90e8\u7ed3\u6784\u7684class\uff0c\u53ef\u7528\u4e8e\u4fee\u6539\u7ec4\u4ef6\u5185\u90e8\u7684\u6837\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>title<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u5bfc\u822a\u6807\u9898\uff0c\u5982\u679c\u4e0d\u63d0\u4f9b\uff0c\u5219\u540d\u4e3acenter\u7684slot\u6709\u6548<\/td>\n<\/tr>\n<tr>\n<td>back<\/td>\n<td>boolean<\/td>\n<td>true<\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793a\u8fd4\u56de\u6309\u94ae\uff0c\u9ed8\u8ba4\u70b9\u51fb\u6309\u94ae\u4f1a\u6267\u884cnavigateBack\uff0c\u5982\u679c\u4e3afalse\uff0c\u5219\u540d\u4e3aleft\u7684slot\u6709\u6548<\/td>\n<\/tr>\n<tr>\n<td>delta<\/td>\n<td>number<\/td>\n<td>1<\/td>\n<td>\u5426<\/td>\n<td>\u5f53back\u4e3atrue\u7684\u65f6\u5019\u6709\u6548\uff0c\u8868\u793anavigateBack\u7684delta\u53c2\u6570<\/td>\n<\/tr>\n<tr>\n<td>background<\/td>\n<td>string<\/td>\n<td>#f8f8f8<\/td>\n<td>\u5426<\/td>\n<td>\u5bfc\u822a\u80cc\u666f\u8272<\/td>\n<\/tr>\n<tr>\n<td>color<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u5bfc\u822a\u989c\u8272<\/td>\n<\/tr>\n<tr>\n<td>loading<\/td>\n<td>boolean<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793a\u6807\u9898\u5de6\u4fa7\u7684loading<\/td>\n<\/tr>\n<tr>\n<td>show<\/td>\n<td>boolean<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u663e\u793a\u9690\u85cf\u5bfc\u822a\uff0c\u9690\u85cf\u7684\u65f6\u5019navigation\u7684\u9ad8\u5ea6\u5360\u4f4d\u8fd8\u5728<\/td>\n<\/tr>\n<tr>\n<td>animated<\/td>\n<td>boolean<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u663e\u793a\u9690\u85cf\u5bfc\u822a\u7684\u65f6\u5019\u662f\u6709opacity\u8fc7\u6e21\u52a8\u753b<\/td>\n<\/tr>\n<tr>\n<td>bindback<\/td>\n<td>eventhandler<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u5728back\u4e3atrue\u65f6\uff0c\u70b9\u51fbback\u6309\u94ae\u89e6\u53d1\u6b64\u4e8b\u4ef6\uff0cdetail\u5305\u542bdelta<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Slot<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u540d\u79f0<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>left<\/td>\n<td>\u5de6\u4fa7slot\uff0c\u5728back\u6309\u94ae\u4f4d\u7f6e\u663e\u793a\uff0c\u5f53back\u4e3afalse\u7684\u65f6\u5019\u6709\u6548<\/td>\n<\/tr>\n<tr>\n<td>center<\/td>\n<td>\u6807\u9898slot\uff0c\u5728\u6807\u9898\u4f4d\u7f6e\u663e\u793a\uff0c\u5f53title\u4e3a\u7a7a\u7684\u65f6\u5019\u6709\u6548<\/td>\n<\/tr>\n<tr>\n<td>right<\/td>\n<td>\u5728\u5bfc\u822a\u7684\u53f3\u4fa7\u663e\u793a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n<h2>Tabbar<\/h2>\n<p>Tabbar\u7ec4\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u4f5c\u4e3a\u5c0f\u7a0b\u5e8f\u7684\u81ea\u5b9a\u4e49Tabbar\u4f7f\u7528<\/p>\n<h2>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h2>\n<pre><code>{\n  \"usingComponents\": {\n    \"mp-tabbar\": \"..\/components\/tabbar\/tabbar\"\n  },\n  \"navigationBarTitleText\": \"UI\u7ec4\u4ef6\u5e93\"\n}<\/code><\/pre>\n<h2>\n<pre><code>&lt;view class=\"page\"&gt;\n    &lt;view class=\"page__hd\"&gt;\n        &lt;view class=\"page__title\"&gt;Tabbar&lt;\/view&gt;\n        &lt;view class=\"page__desc\"&gt;\u7c7b\u4f3c\u5c0f\u7a0b\u5e8f\u539f\u751ftabbar\u7684\u7ec4\u4ef6\uff0c\u53ef\u7528\u4e8e\u81ea\u5b9a\u4e49tabbar&lt;\/view&gt;\n    &lt;\/view&gt;\n    &lt;mp-tabbar style=\"position:fixed;bottom:0;width:100%;left:0;right:0;\" list=\"{{list}}\" bindchange=\"tabChange\"&gt;&lt;\/mp-tabbar&gt;\n&lt;\/view&gt;<\/code><\/pre>\n<\/h2>\n<h2>\n<pre><code>Page({\n    data: {\n        list: [{\n            \"text\": \"\u5bf9\u8bdd\",\n            \"iconPath\": \"..\/..\/images\/tabbar_icon_chat_default.png\",\n          \"selectedIconPath\": \"..\/..\/images\/tabbar_icon_chat_active.png\",\n            dot: true\n        },\n        {\n            \"text\": \"\u8bbe\u7f6e\",\n          \"iconPath\": \"..\/..\/images\/tabbar_icon_setting_default.png\",\n          \"selectedIconPath\": \"..\/..\/images\/tabbar_icon_setting_active.png\",\n            badge: 'New'\n        }]\n    },\n    tabChange(e) {\n        console.log('tab change', e)\n    }\n});<\/code><\/pre>\n<\/h2>\n<h2><\/h2>\n<h2>\u5c5e\u6027\u5217\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ext-class<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u6dfb\u52a0\u5728\u7ec4\u4ef6\u5185\u90e8\u7ed3\u6784\u7684class\uff0c\u53ef\u7528\u4e8e\u4fee\u6539\u7ec4\u4ef6\u5185\u90e8\u7684\u6837\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>list<\/td>\n<td>array&lt;object&gt;<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>Tabbar\u7684\u9879\u7684\u6570\u7ec4\uff0c\u6309\u7167\u89c4\u8303\uff0c\u81f3\u5c11\u8981\u67092\u4e2aTabbar\u9879<\/td>\n<\/tr>\n<tr>\n<td>current<\/td>\n<td>number<\/td>\n<td>0<\/td>\n<td>\u5426<\/td>\n<td>\u5f53\u524d\u9009\u4e2d\u7684Tabbar\u9879\u7684\u4e0b\u6807<\/td>\n<\/tr>\n<tr>\n<td>bindchange<\/td>\n<td>eventhandler<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>Tabbar\u9879\u53d1\u751f\u6539\u6210\u7684\u65f6\u5019\u89e6\u53d1\u6b64\u4e8b\u4ef6\uff0cdetail\u4e3a{index, item}\uff0cindex\u662fTabbar\u4e0b\u6807\uff0citem\u662f\u5bf9\u5e94\u7684Tabbar\u9879\u7684\u914d\u7f6e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>list\u5c5e\u6027\u662f\u5bf9\u8c61\u6570\u7ec4\uff0c\u6bcf\u4e00\u9879\u8868\u793a\u4e00\u4e2aTabbar\u9879\uff0c\u5176\u5b57\u6bb5\u542b\u4e49\u4e3a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5b57\u6bb5\u540d<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>text<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u662f<\/td>\n<td>Tabbar\u9879\u7684\u6807\u9898<\/td>\n<\/tr>\n<tr>\n<td>iconPath<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>Tabbar\u9879\u7684icon\u56fe\u7247\u8def\u5f84\uff0c\u5efa\u8bae\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u76f8\u5bf9\u8def\u5f84\u8981\u76f8\u5bf9\u4e8e\u7ec4\u4ef6\u6240\u5728\u76ee\u5f55\u7684\u3002<\/td>\n<\/tr>\n<tr>\n<td>selectedIconPath<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>Tabbar\u9879\u9009\u4e2d\u65f6\u7684icon\uff0c\u5efa\u8bae\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u76f8\u5bf9\u8def\u5f84\u8981\u76f8\u5bf9\u4e8e\u7ec4\u4ef6\u6240\u5728\u76ee\u5f55\u7684\u3002<\/td>\n<\/tr>\n<tr>\n<td>badge<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793aTabbar\u7684\u53f3\u4e0a\u89d2\u7684Badge<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Navigation Navigation\u662f\u5c0f\u7a0b\u5e8f\u7684\u9876\u90e8\u5bfc\u822a\u7ec4\u4ef6\uff0c\u5f53\u9875\u9762\u914d\u7f6enavigationStyle\u8bbe\u7f6e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":185438,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-185437","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=185437"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185437\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/185438"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=185437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=185437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=185437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}