{"id":1620,"date":"2024-12-02T20:09:47","date_gmt":"2024-12-02T12:09:47","guid":{"rendered":"http:\/\/ericw.top\/?p=1620"},"modified":"2025-09-05T15:31:26","modified_gmt":"2025-09-05T07:31:26","slug":"uni-app-%e7%bb%84%e4%bb%b6%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"http:\/\/ericw.top\/?p=1620","title":{"rendered":"uni-app \u7ec4\u4ef6\u4ecb\u7ecd"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"toc-0\">\u4e00\u3001\u89c6\u56fe\u5bb9\u5668<\/h2>\n\n\n\n<p><strong>1\u3001view<\/strong><\/p>\n\n\n\n<p>\u666e\u901a\u89c6\u56fe\u5bb9\u5668\uff0c\u76f8\u5f53\u4e8e<code class=\"prettyprint\" >HTML<\/code>\u4e2d\u7684<code class=\"prettyprint\" >div<\/code>\uff0c\u53ef\u4ee5\u5305\u88f9\u591a\u79cd\u5143\u7d20\u5185\u5bb9<\/p>\n\n\n\n<p><strong>2\u3001scroll-view<\/strong><\/p>\n\n\n\n<p>\u53ef\u6eda\u52a8\u89c6\u56fe\u533a\u57df\uff0c\u53ef\u4ee5\u6a2a\u5411\u6eda\u52a8\u548c\u7eb5\u5411\u6eda\u52a8\uff0c\u4e00\u822c\u7528\u4e8e\u533a\u57df\u6eda\u52a8\uff0c\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u6709\u9650\u7684\u9875\u9762\uff0c\u65e0\u6cd5\u5c55\u793a\u6211\u4eec\u7684\u5168\u90e8\u9700\u6c42\uff0c\u6240\u4ee5\u9700\u8981\u6eda\u52a8\u6765\u5c55\u793a\u66f4\u591a\u3002\uff08\u4f8b\u5982\u4e0b\u62c9\u89e6\u5e95\u5237\u65b0\u7684\u529f\u80fd\uff09<\/p>\n\n\n\n<p>\u5e38\u7528\u5c5e\u6027\u8bf4\u660e\uff1a<\/p>\n\n\n\n<p><code class=\"prettyprint\" >scroll-x<\/code> \u5141\u8bb8\u6a2a\u5411\u6eda\u52a8 <\/p>\n\n\n\n<p><code class=\"prettyprint\" >scroll-y<\/code> \u5141\u8bb8\u7eb5\u5411\u6eda\u52a8<\/p>\n\n\n\n<p><code class=\"prettyprint\" >upper-threshold<\/code> \u8ddd\u9876\u90e8\/\u5de6\u8fb9\u591a\u8fdc\u65f6\uff08\u5355\u4f4dpx\uff09\uff0c\u89e6\u53d1 <code class=\"prettyprint\" >scrolltoupper<\/code> \u4e8b\u4ef6 <\/p>\n\n\n\n<p><code class=\"prettyprint\" >lower-threshold<\/code> \u8ddd\u5e95\u90e8\/\u53f3\u8fb9\u591a\u8fdc\u65f6\uff08\u5355\u4f4dpx\uff09\uff0c\u89e6\u53d1 <code class=\"prettyprint\" >scrolltolower<\/code> \u4e8b\u4ef6 <\/p>\n\n\n\n<p><strong>3\u3001swiper<\/strong><\/p>\n\n\n\n<p>\u6ed1\u52a8\u89c6\u56fe\u5bb9\u5668<br>\u4e00\u822c\u7528\u4e8e\u5de6\u53f3\u6ed1\u52a8\uff0c\u4f8b\u5982\u8f6e\u64ad\u56fe<\/p>\n\n\n\n<p>\u6ce8\u610f\u6ed1\u52a8\u5207\u6362\u548c\u6eda\u52a8\u7684\u533a\u522b\uff0c\u6ed1\u52a8\u5207\u6362\u662f\u4e00\u5c4f\u4e00\u5c4f\u7684\u5207\u6362\u3002swiper\u4e0b\u7684\u6bcf\u4e2aswiper-item\u662f\u4e00\u4e2a\u6ed1\u52a8\u5207\u6362\u533a\u57df\uff0c\u4e0d\u80fd\u505c\u7559\u57282\u4e2a\u6ed1\u52a8\u533a\u57df\u4e4b\u95f4\u3002<\/p>\n\n\n\n<p>\u5e38\u7528\u5c5e\u6027\u8bf4\u660e\uff1a<\/p>\n\n\n\n<p>autoplay\uff1a\u662f\u5426\u81ea\u52a8\u64ad\u653e\uff0c\u9ed8\u8ba4\u4e3afalse\u3002<br>interval\uff1a\u81ea\u52a8\u64ad\u653e\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2\uff0c\u9ed8\u8ba4\u4e3a5000\u3002<br>duration\uff1a\u6ed1\u52a8\u52a8\u753b\u7684\u65f6\u957f\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2\uff0c\u9ed8\u8ba4\u4e3a500\u3002<br>circular\uff1a\u662f\u5426\u91c7\u7528\u8854\u63a5\u6ed1\u52a8\uff0c\u9ed8\u8ba4\u4e3afalse\u3002<br>indicator-dots\uff1a\u662f\u5426\u663e\u793a\u6307\u793a\u70b9\uff0c\u9ed8\u8ba4\u4e3afalse\u3002<br>indicator-color\uff1a\u6307\u793a\u70b9\u989c\u8272\u3002<br>indicator-active-color\uff1a\u5f53\u524d\u9009\u4e2d\u7684\u6307\u793a\u70b9\u989c\u8272\u3002<br>vertical\uff1a\u662f\u5426\u4e3a\u7eb5\u5411\u6ed1\u52a8\uff0c\u9ed8\u8ba4\u4e3afalse\u3002\u53ef\u4ee5\u5728swiper\u7ec4\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0a\u5c5e\u6027<br><\/p>\n\n\n\n<p><strong>\u7528\u6cd5\u4ecb\u7ecd\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >&lt;swiper autoplay=&quot;true&quot; interval=&quot;3000&quot; circular=&quot;true&quot; indicator-dots=&quot;true&quot; indicator-color=&quot;#ffffff&quot; indicator-active-color=&quot;#ff0000&quot;&gt;\n  &lt;swiper-item&gt;\n    &lt;!-- \u8fd9\u91cc\u662f\u8f6e\u64ad\u56fe\u7684\u5185\u5bb9 --&gt;\n  &lt;\/swiper-item&gt;\n  &lt;swiper-item&gt;\n    &lt;!-- \u8fd9\u91cc\u662f\u8f6e\u64ad\u56fe\u7684\u5185\u5bb9 --&gt;\n  &lt;\/swiper-item&gt;\n  &lt;swiper-item&gt;\n    &lt;!-- \u8fd9\u91cc\u662f\u8f6e\u64ad\u56fe\u7684\u5185\u5bb9 --&gt;\n  &lt;\/swiper-item&gt;\n&lt;\/swiper&gt;\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-1\">\u4e8c\u3001\u57fa\u7840\u5185\u5bb9<\/h2>\n\n\n\n<p><strong>1\u3001text<\/strong><\/p>\n\n\n\n<p>Text\u7ec4\u4ef6\u7528\u4e8e\u663e\u793a\u9759\u6001\u6587\u672c\u5185\u5bb9\uff0c\u5176\u57fa\u672c\u7528\u6cd5\u975e\u5e38\u7b80\u5355\u3002<\/p>\n\n\n\n<p>text\u7ec4\u4ef6\u5728web\u6d4f\u89c8\u5668\u6e32\u67d3\uff08\u542b\u6d4f\u89c8\u5668\u3001\u5c0f\u7a0b\u5e8fwebview\u6e32\u67d3\u6a21\u5f0f\u3001app-vue\uff09\u548cuvue\u4e2d\uff0c\u53ef\u4ee5\u5e76\u53ea\u80fd\u5d4c\u5957text\u7ec4\u4ef6<\/p>\n\n\n\n<p><strong>\u5e38\u7528\u5c5e\u6027\u4ecb\u7ecd\uff1a<\/strong><\/p>\n\n\n\n<p>color: \u8bbe\u7f6e\u6587\u672c\u989c\u8272\uff0c\u53ef\u4ee5\u63a5\u53d7CSS\u989c\u8272\u503c\u6216\u9884\u5b9a\u4e49\u7684\u989c\u8272\u540d\u79f0\u3002<br>font-size: \u8bbe\u7f6e\u6587\u672c\u7684\u5b57\u4f53\u5927\u5c0f\u3002<br>font-weight: \u8bbe\u7f6e\u6587\u672c\u7684\u5b57\u4f53\u7c97\u7ec6\u3002<br>text-align: \u8bbe\u7f6e\u6587\u672c\u7684\u5bf9\u9f50\u65b9\u5f0f\uff0c\u53ef\u9009\u503c\u5305\u62ec\"left\"\u3001\u201cright\u201d\u3001\"center\"\u7b49\u3002<br>text-decoration: \u8bbe\u7f6e\u6587\u672c\u7684\u88c5\u9970\u6548\u679c\uff0c\u5982\u4e0b\u5212\u7ebf\u3001\u5220\u9664\u7ebf\u7b49\u3002<br>\u5728\u91cc\u9762\u4e5f\u53ef\u4ee5\u4f7f\u7528\u63d2\u69fd\u6765\u5c55\u793a\u6587\u672c  <code class=\"prettyprint\" >&lt;text&gt;{{ message }}&lt;\/text&gt;<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-2\">\u4e09\u3001\u8868\u5355\u7ec4\u4ef6<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u7684\u4e00\u4e9b\u7ec4\u4ef6\u90fd\u662f\u5728Vue\u4e2d\u5b66\u4e60\u8fc7\u7684\uff0c\u53ea\u662f\u589e\u52a0\u4e86\u4e00\u4e9b\u7279\u6027\uff0c\u5c31\u4e0d\u505a\u8be6\u7ec6\u4ecb\u7ecd\u4e86<\/p>\n\n\n\n<p><strong>1\u3001button<\/strong><\/p>\n\n\n\n<p>\u6309\u94ae\u7ec4\u4ef6\uff0c\u7528\u4e8e\u89e6\u53d1\u4e00\u4e2a\u64cd\u4f5c<\/p>\n\n\n\n<p>\u6309\u94ae\u652f\u6301&nbsp;<code class=\"prettyprint\" >default<\/code>\u3001<code class=\"prettyprint\" >primary<\/code>\u3001<code class=\"prettyprint\" >info<\/code>\u3001<code class=\"prettyprint\" >warning<\/code>\u3001<code class=\"prettyprint\" >danger<\/code>\u3001<code class=\"prettyprint\" >success<\/code>&nbsp;\u516d\u79cd\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a&nbsp;<code class=\"prettyprint\" >default<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >&lt;template&gt;\n  &lt;nut-button type=&quot;primary&quot;&gt;\u4e3b\u8981\u6309\u94ae&lt;\/nut-button&gt;\n  &lt;nut-button type=&quot;info&quot;&gt;\u4fe1\u606f\u6309\u94ae&lt;\/nut-button&gt;\n  &lt;nut-button type=&quot;default&quot;&gt;\u9ed8\u8ba4\u6309\u94ae&lt;\/nut-button&gt;\n  &lt;nut-button type=&quot;danger&quot;&gt;\u5371\u9669\u6309\u94ae&lt;\/nut-button&gt;\n  &lt;nut-button type=&quot;warning&quot;&gt;\u8b66\u544a\u6309\u94ae&lt;\/nut-button&gt;\n  &lt;nut-button type=&quot;success&quot;&gt;\u6210\u529f\u6309\u94ae&lt;\/nut-button&gt;\n&lt;\/template&gt;<\/code><\/pre>\n\n\n\n<p><strong>\u5e38\u7528\u5c5e\u6027\u8bf4\u660e\uff1a<\/strong><\/p>\n\n\n\n<p>size  \u6309\u94ae\u7684\u5927\u5c0f<\/p>\n\n\n\n<p>type  \u6309\u94ae\u7684\u6837\u5f0f\u7c7b\u578b<\/p>\n\n\n\n<p>aisabled  \u6309\u94ae\u662f\u5426\u7981\u7528<\/p>\n\n\n\n<p>2\u3001checkbox  \u591a\u9009\u6846<\/p>\n\n\n\n<p>3\u3001editor  \u5bcc\u6587\u672c\u7f16\u8f91\u5668<\/p>\n\n\n\n<p>4\u3001form  \u8868\u5355\u57df<\/p>\n\n\n\n<p>5\u3001input  \u8f93\u5165\u6846<\/p>\n\n\n\n<p>6\u3001label  <br>\u7528\u6765\u6539\u8fdb\u8868\u5355\u7ec4\u4ef6\u7684\u53ef\u7528\u6027\uff0c\u4f7f\u7528for\u5c5e\u6027\u627e\u5230\u5bf9\u5e94\u7684id\uff0c\u6216\u8005\u5c06\u63a7\u4ef6\u653e\u5728\u8be5\u6807\u7b7e\u4e0b\uff0c\u5f53\u70b9\u51fb\u65f6\uff0c\u5c31\u4f1a\u89e6\u53d1\u5bf9\u5e94\u7684\u63a7\u4ef6\u3002<\/p>\n\n\n\n<p>7\u3001radio  \u5355\u9009\u6846<\/p>\n\n\n\n<p>8\u3001slider  \u6ed1\u52a8\u9009\u62e9\u5668<\/p>\n\n\n\n<p>9\u3001switch  \u5f00\u5173\u9009\u62e9\u5668<\/p>\n\n\n\n<p>10\u3001textarea  \u6587\u672c\u57df<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-3\">\u56db\u3001\u8def\u7531\u8df3\u8f6c<\/h2>\n\n\n\n<p><strong>1\u3001navigator<\/strong><\/p>\n\n\n\n<p>\u8be5\u7ec4\u4ef6\u7c7b\u4f3cHTML\u4e2d\u7684<code class=\"prettyprint\" >&lt;a&gt;<\/code>\u7ec4\u4ef6\uff0c\u4f46\u53ea\u80fd\u8df3\u8f6c\u672c\u5730\u9875\u9762\u3002<\/p>\n\n\n\n<p><strong>\u5e38\u7528\u5c5e\u6027\u8bf4\u660e\uff1a<\/strong><\/p>\n\n\n\n<p>\u8df3\u8f6c\u65b9\u5f0f\uff1a  <code class=\"prettyprint\" >open-type=<\/code><br>\u9ed8\u8ba4\u65b9\u5f0f  <code class=\"prettyprint\" >navigate<\/code>  \u65b0\u9875\u9762<br><code class=\"prettyprint\" >redirect<\/code>  \u5f53\u524d\u9875\u9762\u6253\u5f00<br><code class=\"prettyprint\" >switchTab<\/code>  \u8df3\u8f6c\u5230Tab\u9875\u9762\u6253\u5f00<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >&lt;navigator url=&quot;navigate\/navigate?title=navigate&quot; hover-class=&quot;navigator-hover&quot;&gt;\n    &lt;button type=&quot;default&quot;&gt;\u8df3\u8f6c\u5230\u65b0\u9875\u9762&lt;\/button&gt;\n&lt;\/navigator&gt;\n\n&lt;navigator url=&quot;redirect\/redirect?title=redirect&quot; open-type=&quot;redirect&quot; hover-class=&quot;other-navigator-hover&quot;&gt;\n    &lt;button type=&quot;default&quot;&gt;\u5728\u5f53\u524d\u9875\u6253\u5f00&lt;\/button&gt;\n&lt;\/navigator&gt;\n\n&lt;navigator url=&quot;\/pages\/tabBar\/extUI\/extUI&quot; open-type=&quot;switchTab&quot; hover-class=&quot;other-navigator-hover&quot;&gt;\n    &lt;button type=&quot;default&quot;&gt;\u8df3\u8f6ctab\u9875\u9762&lt;\/button&gt;\n&lt;\/navigator&gt;<\/code><\/pre>\n\n\n\n<p><strong>2\u3001navigateTo<\/strong><\/p>\n\n\n\n<p><strong>\u5229\u7528navigateTo\u8fdb\u884c\u5bfc\u822a\u8df3\u8f6c<\/strong><\/p>\n\n\n\n<p>\u4fdd\u7559\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762\uff0c\u4f7f\u7528<code class=\"prettyprint\" >uni.navigateBack<\/code>\u53ef\u4ee5\u8fd4\u56de\u5230\u539f\u9875\u9762\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >go () {\n  uni.navigateTo({\n    url: &#039;\/pages\/about\/about&#039;,\n  })\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u89c6\u56fe\u5bb9\u5668 1\u3001view \u666e\u901a\u89c6\u56fe\u5bb9\u5668\uff0c\u76f8\u5f53\u4e8eHTML\u4e2d\u7684div\uff0c\u53ef\u4ee5\u5305\u88f9\u591a\u79cd\u5143\u7d20\u5185\u5bb9 2\u3001scroll-v [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,11],"tags":[],"_links":{"self":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/1620"}],"collection":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1620"}],"version-history":[{"count":12,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/1620\/revisions"}],"predecessor-version":[{"id":1634,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/1620\/revisions\/1634"}],"wp:attachment":[{"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1620"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}