{"id":54325,"date":"2025-08-13T01:59:59","date_gmt":"2025-08-12T17:59:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/54325.html"},"modified":"2025-08-13T01:59:59","modified_gmt":"2025-08-12T17:59:59","slug":"%e3%80%90%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%af%87-06%e3%80%91%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3npm%e6%94%af%e6%8c%81%e5%92%8c%e5%88%86%e5%8c%85%e5%8a%a0%e8%bd%bd","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/54325.html","title":{"rendered":"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d"},"content":{"rendered":"<\/p>\n<h4>\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d<\/h4>\n<ul>\n<li>\u4e00&#xff0c;npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d<\/li>\n<li>\n<ul>\n<li>1&#xff0c;npm\u652f\u6301<\/li>\n<li>\n<ul>\n<li>1.1&#xff0c;npm\u5305\u7684\u57fa\u672c\u4f7f\u7528<\/li>\n<li>1.2&#xff0c;npm\u81ea\u5b9a\u4e49\u6784\u5efa<\/li>\n<li>1.3&#xff0c;vant\u7ec4\u4ef6\u5e93\u7684\u4f7f\u7528<\/li>\n<li>1.4&#xff0c;vant\u7ec4\u4ef6\u6837\u5f0f\u8986\u76d6<\/li>\n<\/ul>\n<\/li>\n<li>2&#xff0c;\u5206\u5305\u52a0\u8f7d<\/li>\n<li>\n<ul>\n<li>2.1&#xff0c;\u5206\u5305\u52a0\u8f7d\u57fa\u672c\u4ecb\u7ecd<\/li>\n<li>2.2&#xff0c;\u5206\u5305\u914d\u7f6e\u4ee5\u53ca\u6253\u5305\u5f15\u7528\u539f\u5219<\/li>\n<li>2.3&#xff0c;\u72ec\u7acb\u5206\u5305<\/li>\n<li>2.4&#xff0c;\u5206\u5305\u9884\u4e0b\u8f7d<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u4e00&#xff0c;npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d<\/h2>\n<h3>1&#xff0c;npm\u652f\u6301<\/h3>\n<h4>1.1&#xff0c;npm\u5305\u7684\u57fa\u672c\u4f7f\u7528<\/h4>\n<p>\u76ee\u524d\u5c0f\u7a0b\u5e8f\u5df2\u7ecf\u652f\u6301\u4f7f\u7528npm\u5b89\u88c5\u7b2c\u4e09\u65b9\u5305&#xff0c;\u56e0\u4e3anode_modules \u76ee\u5f55\u4e2d\u7684\u5305\u4e0d\u4f1a\u53c2\u4e0e\u5c0f\u7a0b\u5e8f\u9879\u76ee\u7684\u7f16\u8bd1\u3001\u4e0a\u4f20\u548c\u6253\u5305&#xff0c;\u56e0\u6b64\u5728\u5c0f\u7a0b\u5e8f\u9879\u76ee\u4e2d\u8981\u4f7f\u7528npm\u5305&#xff0c;\u5fc5\u987b\u8d70\u4e00\u904d \u6784\u5efanpm \u7684\u8fc7\u7a0b\u3002\u9996\u5148\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u83b7\u53d6\u8fd9\u4e2apackage.json\u6587\u4ef6<\/p>\n<p>npm init <span class=\"token operator\">&#8211;<\/span>y<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175952-689b8118b3d4d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u968f\u540e\u5b89\u88c5vant\u7684weapp\u7ec4\u4ef6\u5e93&#xff0c;\u5176\u4ee3\u7801\u5982\u4e0b\u3002\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e&#xff0c;\u4f1a\u5728package.json\u6587\u4ef6\u7684dependencies\u4e2d\u51fa\u73b0\u5b89\u88c5\u7684&#064;vant\/weapp\u4ee5\u53ca\u5bf9\u5e94\u7684\u7248\u672c\u53f7<\/p>\n<p>npm i <span class=\"token annotation punctuation\">&#064;vant<\/span><span class=\"token operator\">\/<\/span>weapp<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175954-689b811a250ab.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u6700\u540e\u518d\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e&#xff0c;\u9700\u8981\u5728\u5de5\u5177\u680f\u70b9\u51fb\u6784\u5efanpm&#xff0c;\u968f\u540e\u4f1a\u51fa\u73b0\u8fd9\u4e2a miniprogram_npm &#xff0c;\u8fd9\u4e2a\u5305\u91cc\u9762\u5b58\u7740\u6784\u5efa\u597d\u7684npm\u5305<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175955-689b811b3300d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>npm\u5305\u6307\u7684\u662f\u4e13\u95e8\u4e3a\u5c0f\u7a0b\u5e8f\u5b9a\u5236\u7684npm\u5305&#xff0c;\u7b80\u79f0\u5c0f\u7a0b\u5e8fnpm\u5305&#xff0c;\u56e0\u6b64\u5728\u4f7f\u7528\u5305\u4e4b\u524d\u9700\u8981\u5148\u786e\u8ba4\u4e0b\u8be5\u5305\u662f\u5426\u652f\u6301\u5c0f\u7a0b\u5e8f\u3002\u6bd4\u5982\u4e00\u4e2adom\u5305&#xff0c;\u5982\u679c\u5c0f\u7a0b\u5e8f\u5185\u90e8\u4e0d\u652f\u6301\u7684\u8bdd&#xff0c;\u90a3\u4e48\u5c31\u4e0d\u80fd\u4f7f\u7528\u3002<\/p>\n<h4>1.2&#xff0c;npm\u81ea\u5b9a\u4e49\u6784\u5efa<\/h4>\n<p>\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;\u968f\u7740\u9879\u76ee\u529f\u80fd\u7684\u8d8a\u6765\u8d8a\u591a\u3001\u9879\u76ee\u8d8a\u6765\u8d8a\u590d\u6742&#xff0c;\u6587\u4ef6\u76ee\u5f55\u4e5f\u53d8\u5f97\u5f88\u7e41\u7410&#xff0c;\u4e3a\u4e86\u65b9\u4fbf\u8fdb\u884c\u9879\u76ee\u7684\u5f00\u53d1&#xff0c;\u5f00\u53d1\u4eba\u5458\u901a\u5e38\u4f1a\u5bf9\u76ee\u5f55\u7ed3\u6784\u8fdb\u884c\u8c03\u6574&#xff0c;\u4f8b\u5982\u5c06\u5c0f\u7a0b\u5e8f\u6e90\u7801\u653e\u5230 miniprogram \u76ee\u5f55\u4e0b&#xff0c;\u6b64\u65f6\u5c31\u9700\u8981\u5f00\u53d1\u8005\u5728project.config.json\u4e2d\u6307\u5b9anode_modules\u7684\u4f4d\u7f6e\u548c\u76ee\u6807miniprogram_npm \u7684\u4f4d\u7f6e<\/p>\n<p>\u9996\u5148\u5c06\u539f\u59cb\u7684\u4e00\u4e9b\u9875\u9762&#xff0c;\u9759\u6001\u8d44\u6e90\u7b49\u5168\u90e8\u653e\u5728src\u76ee\u5f55\u4e0b\u6216\u8005miniprogram\u76ee\u5f55\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175955-689b811b87bb4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u968f\u540e\u6253\u5f00\u7ec8\u7aef&#xff0c;\u6267\u884c\u521d\u59cb\u5316npm\u548c\u6784\u5efanpm\u7684\u547d\u4ee4<\/p>\n<p>npm init <span class=\"token operator\">&#8211;<\/span>y<br \/>\nnpm i <span class=\"token annotation punctuation\">&#064;vant<\/span><span class=\"token operator\">\/<\/span>weapp<\/p>\n<p>\u968f\u540e\u5728project.config.json\u6587\u4ef6\u4e2d&#xff0c;\u5728setting\u5c5e\u6027\u4e0b&#xff0c;\u914d\u7f6epackNpmManually\u5c5e\u6027\u548cminiprogramNpmDistDir\u5c5e\u6027&#xff0c;\u5176\u5177\u4f53\u8be6\u60c5\u5982\u4e0b&#xff0c;\u540c\u65f6\u8fd8\u9700\u8981\u914d\u7f6e miniprogramRoot<\/p>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;compileType&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token string\">&#034;miniprogram&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;miniprogramRoot&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/miniprogram&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;setting&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;packNpmManually&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string-property property\">&#034;packNpmRelationList&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token punctuation\">[<\/span><br \/>\n      <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string-property property\">&#034;packageJsonPath&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/package.json&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token string-property property\">&#034;miniprogramNpmDistDir&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;.\/miniprogram&#034;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>1.3&#xff0c;vant\u7ec4\u4ef6\u5e93\u7684\u4f7f\u7528<\/h4>\n<p>\u5728\u5b66\u4e60\u8fd9\u4e2a\u7ec4\u4ef6\u4e4b\u524d&#xff0c;\u53ef\u4ee5\u5148\u53bb\u770b\u4e00\u4e0b\u5b98\u7f51\u4e0a\u9762\u7684\u7ec4\u4ef6\u4ecb\u7ecd\u548c\u57fa\u672c\u4f7f\u7528&#xff1a;https:\/\/vant-ui.github.io\/vant-weapp\/#\/image &#xff0c;\u8fd9\u91cc\u9009\u62e9\u4e00image\u4e3a\u4f8b\u5b50&#xff0c;\u8bb2\u4e00\u4e0b\u8fd9\u4e2a\u7ec4\u4ef6\u5e93\u7684\u57fa\u672c\u4f7f\u7528\u3002<\/p>\n<p>\u968f\u540e\u9700\u8981\u5728index.json\u6587\u4ef6\u6216\u8005app.json\u6587\u4ef6\u4e2d\u6ce8\u518c\u8fd9\u4e2a\u7ec4\u4ef6<\/p>\n<p><span class=\"token string\">&#034;usingComponents&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string\">&#034;van-image&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;&#064;vant\/weapp\/image\/index&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u968f\u540e\u518dindex.wxml\u4e2d\u76f4\u63a5\u4f7f\u7528\u5b98\u7f51\u7ed9\u7684\u6848\u4f8b\u5373\u53ef<\/p>\n<p><span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>image width<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;100&#034;<\/span> height<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;100&#034;<\/span> src<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;https:\/\/img.yzcdn.cn\/vant\/cat.jpeg&#034;<\/span> <span class=\"token operator\">\/<\/span><span class=\"token operator\">&gt;<\/span><\/p>\n<p>\u8fd9\u4e2asrc\u4f7f\u7528\u7684\u53c2\u6570\u53ef\u4ee5\u5982\u4e0b&#xff0c;\u5f53\u7136\u8be6\u60c5\u4e5f\u53ef\u4ee5\u76f4\u63a5\u53c2\u8003\u5b98\u7f51<\/p>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e\u7c7b\u578b\u9ed8\u8ba4\u503c<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">src<\/td>\n<td align=\"left\">\u56fe\u7247\u94fe\u63a5<\/td>\n<td align=\"left\">string<\/td>\n<td align=\"left\">&#8211;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">fit<\/td>\n<td align=\"left\">\u56fe\u7247\u586b\u5145\u6a21\u5f0f<\/td>\n<td align=\"left\">string<\/td>\n<td align=\"left\">fill<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">alt<\/td>\n<td align=\"left\">\u66ff\u4ee3\u6587\u672c<\/td>\n<td align=\"left\">string<\/td>\n<td align=\"left\">&#8211;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">width<\/td>\n<td align=\"left\">\u5bbd\u5ea6&#xff0c;\u9ed8\u8ba4\u5355\u4f4d\u4e3apx<\/td>\n<td align=\"left\">string | number<\/td>\n<td align=\"left\">&#8211;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">height<\/td>\n<td align=\"left\">\u9ad8\u5ea6&#xff0c;\u9ed8\u8ba4\u5355\u4f4d\u4e3apx<\/td>\n<td align=\"left\">string | number<\/td>\n<td align=\"left\">&#8211;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">radius<\/td>\n<td align=\"left\">\u5706\u89d2\u5927\u5c0f&#xff0c;\u9ed8\u8ba4\u5355\u4f4d\u4e3apx<\/td>\n<td align=\"left\">string | number<\/td>\n<td align=\"left\">0<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">round<\/td>\n<td align=\"left\">\u662f\u5426\u663e\u793a\u4e3a\u5706\u5f62<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">lazy-load<\/td>\n<td align=\"left\">\u662f\u5426\u61d2\u52a0\u8f7d<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">webp v1.10.11<\/td>\n<td align=\"left\">\u662f\u5426\u89e3\u6790 webp \u683c\u5f0f<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">show-error<\/td>\n<td align=\"left\">\u662f\u5426\u5c55\u793a\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\u63d0\u793a<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">true<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">show-loading<\/td>\n<td align=\"left\">\u662f\u5426\u5c55\u793a\u56fe\u7247\u52a0\u8f7d\u4e2d\u63d0\u793a<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">true<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">use-error-slot<\/td>\n<td align=\"left\">\u662f\u5426\u4f7f\u7528 error \u63d2\u69fd<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">use-loading-slot<\/td>\n<td align=\"left\">\u662f\u5426\u4f7f\u7528 loading \u63d2\u69fd<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">show-menu-by-longpress<\/td>\n<td align=\"left\">\u662f\u5426\u5f00\u542f\u957f\u6309\u56fe\u7247\u663e\u793a\u8bc6\u522b\u5c0f\u7a0b\u5e8f\u7801\u83dc\u5355<\/td>\n<td align=\"left\">boolean<\/td>\n<td align=\"left\">false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u9664\u4e86\u8fd9\u4e9b\u57fa\u672c\u5c5e\u6027\u4e4b\u5916&#xff0c;\u4e5f\u53ef\u4ee5\u7ed9\u8fd9\u4e9b\u56fe\u7247\u7ed1\u5b9a\u4e00\u4e9b\u4e8b\u4ef6<\/p>\n<p>Events<\/p>\n<table>\n<tr>\u4e8b\u4ef6\u540d\u8bf4\u660e\u56de\u8c03\u53c2\u6570<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">bind:click<\/td>\n<td align=\"left\">\u70b9\u51fb\u56fe\u7247\u65f6\u89e6\u53d1<\/td>\n<td align=\"left\">event: Event<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">bind:load<\/td>\n<td align=\"left\">\u56fe\u7247\u52a0\u8f7d\u5b8c\u6bd5\u65f6\u89e6\u53d1<\/td>\n<td align=\"left\">event: Event<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">bind:error<\/td>\n<td align=\"left\">\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\u65f6\u89e6\u53d1<\/td>\n<td align=\"left\">event: Event<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Slots<\/p>\n<table>\n<tr>\u540d\u79f0\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">loading<\/td>\n<td align=\"left\">\u81ea\u5b9a\u4e49\u52a0\u8f7d\u4e2d\u7684\u63d0\u793a\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">error<\/td>\n<td align=\"left\">\u81ea\u5b9a\u4e49\u52a0\u8f7d\u5931\u8d25\u65f6\u7684\u63d0\u793a\u5185\u5bb9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5916\u90e8\u6837\u5f0f\u7c7b<\/p>\n<table>\n<tr>\u7c7b\u540d\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">custom-class<\/td>\n<td align=\"left\">\u6839\u8282\u70b9\u6837\u5f0f\u7c7b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">image-class<\/td>\n<td align=\"left\">\u56fe\u7247\u6837\u5f0f\u7c7b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">loading-class<\/td>\n<td align=\"left\">loading \u6837\u5f0f\u7c7b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">error-class<\/td>\n<td align=\"left\">error \u6837\u5f0f\u7c7b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>1.4&#xff0c;vant\u7ec4\u4ef6\u6837\u5f0f\u8986\u76d6<\/h4>\n<p>Vant weapp\u57fa\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u673a\u5236&#xff0c;\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e863\u4e2d\u4fee\u6539\u7ec4\u4ef6\u6837\u5f0f\u7684\u65b9\u6cd5<\/p>\n<ul>\n<li>\u89e3\u9664\u6837\u5f0f\u9694\u79bb&#xff1a;\u5728\u9875\u9762\u4e2d\u4f7f\u7528Vant Weapp\u7ec4\u4ef6\u65f6&#xff0c;\u53ef\u76f4\u63a5\u5728\u9875\u9762\u7684\u6837\u5f0f\u6587\u4ef6\u4e2d\u8986\u76d6\u6837\u5f0f<\/li>\n<li>\u4f7f\u7528\u5916\u90e8\u6837\u5f0f\u7c7b&#xff1a;\u666e\u901a\u6837\u5f0f\u7c7b\u548c\u5916\u90e8\u6837\u5f0f\u7c7b\u7684\u4f18\u5148\u7ea7\u662f\u672a\u5b9a\u4e49\u7684&#xff0c;\u9700\u8981\u6dfb\u52a0**!important**\u4fdd\u8bc1\u4f18\u5148\u7ea7<\/li>\n<li>\u4f7f\u7528CSS\u53d8\u91cf&#xff1a;\u5728\u9875\u9762\u6216\u5168\u5c40\u5bf9\u591a\u4e2a\u7ec4\u4ef6\u7684\u6837\u5f0f\u505a\u6279\u91cf\u4fee\u6539\u4ee5\u8fdb\u884c\u4e3b\u9898\u6837\u5f0f\u7684\u5b9a\u5236<\/li>\n<\/ul>\n<p>\u4ee5\u6309\u94ae\u4e3b\u952e\u4e3a\u4f8b&#xff0c;\u56e0\u6b64\u9700\u8981\u5c06vant-button\u6309\u94ae\u6ce8\u518c\u5230\u5168\u90e8\u8def\u5f84\u4e2d<\/p>\n<p><span class=\"token string\">&#034;usingComponents&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string\">&#034;van-button&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;&#064;vant\/weapp\/button\/index&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5b98\u7f51\u63d0\u4f9b\u7684\u6309\u94ae\u6709\u4ee5\u4e0b\u51e0\u79cd&#xff0c;type\u548c\u5e38\u89c4\u7684\u4e00\u6837<\/p>\n<p><span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;default&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u9ed8\u8ba4\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;primary&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u4e3b\u8981\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;info&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u4fe1\u606f\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;warning&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u8b66\u544a\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;danger&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u5371\u9669\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175955-689b811ba0381.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>1&#xff0c;\u89e3\u9664\u6837\u5f0f\u9694\u79bb<\/p>\n<p>\u63a5\u4e0b\u6765\u4ee5\u4e3b\u8981\u6309\u94ae\u4e3a\u4f8b&#xff0c;\u9996\u5148\u6765\u9a8c\u8bc1\u7b2c\u4e00\u79cd\u89e3\u9664\u6837\u5f0f\u9694\u79bb<\/p>\n<p><span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;primary&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u4e3b\u8981\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><\/p>\n<p>\u8bbe\u7f6e\u5b83\u7684\u6837\u5f0f\u5982\u4e0b&#xff0c;\u5982\u679c\u662f\u5728\u975e\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u76f4\u63a5\u5728wxss\u4e2d\u4fee\u6539\u6837\u5f0f&#xff0c;\u90a3\u4e48\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539\u6210\u529f\u3002<\/p>\n<p><span class=\"token punctuation\">.<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&#8212;<\/span>primary <span class=\"token punctuation\">{<\/span><br \/>\n  font<span class=\"token operator\">&#8211;<\/span>size<span class=\"token operator\">:<\/span> <span class=\"token number\">28<\/span>rpx <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  background<span class=\"token operator\">&#8211;<\/span>color<span class=\"token operator\">:<\/span> lightseagreen <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  border<span class=\"token operator\">:<\/span> <span class=\"token number\">1<\/span>px solid lightseagreen <span class=\"token operator\">!<\/span>important<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175956-689b811c03418.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u5982\u679c\u662f\u5728\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u8fd9\u4e2a\u6837\u5f0f\u8986\u76d6&#xff0c;\u90a3\u4e48\u9700\u8981\u5728\u81ea\u5b9a\u4e49\u7ec4\u4ef6js\u6587\u4ef6\u4e2d\u5c06styleIsolation\u8bbe\u7f6e\u4e3a\u5171\u4eab\u6a21\u5f0f&#xff0c;\u90a3\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539\u6210\u529f<\/p>\n<p><span class=\"token class-name\">Component<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><br \/>\n  options<span class=\"token operator\">:<\/span><span class=\"token punctuation\">{<\/span><br \/>\n    styleIsolation<span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;shared&#034;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>2&#xff0c;\u4f7f\u7528\u5916\u90e8\u6837\u5f0f\u7c7b<\/p>\n<p>\u4f9d\u65e7\u662f\u4f7f\u7528\u8fd9\u4e2abutton\u6309\u94ae&#xff0c;\u52a0\u4e0a\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u5916\u90e8\u6837\u5f0f\u7c7bcustom-calss&#xff0c;\u4ed6\u662f\u4e00\u4e2a\u6839\u8282\u70b9\u6837\u5f0f\u7c7b<\/p>\n<p><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>van-button<\/span> <span class=\"token attr-name\">type<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>primary<span class=\"token punctuation\">&#034;<\/span><\/span> <span class=\"token attr-name\">custom-class<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>custom-button<span class=\"token punctuation\">&#034;<\/span><\/span><span class=\"token punctuation\">&gt;<\/span><\/span>\u4e3b\u8981\u6309\u94ae<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>van-button<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><\/p>\n<p>\u5728wxss\u6587\u4ef6\u4e2d\u5b9a\u4e49\u8fd9\u4e2a\u6837\u5f0f&#xff0c;\u4f9d\u65e7\u662f\u6240\u6709\u7684\u6837\u5f0f\u90fd\u8981\u8bbe\u7f6e\u6743\u91cd<\/p>\n<p><span class=\"token punctuation\">.<\/span>custom<span class=\"token operator\">&#8211;<\/span>button<span class=\"token punctuation\">{<\/span><br \/>\n  font<span class=\"token operator\">&#8211;<\/span>size<span class=\"token operator\">:<\/span> <span class=\"token number\">28<\/span>rpx <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  background<span class=\"token operator\">&#8211;<\/span>color<span class=\"token operator\">:<\/span> lightseagreen <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  border<span class=\"token operator\">:<\/span> <span class=\"token number\">1<\/span>px solid lightseagreen <span class=\"token operator\">!<\/span>important<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>3&#xff0c;\u4f7f\u7528CSS\u53d8\u91cf<\/p>\n<p>\u4f9d\u65e7\u662f\u4f7f\u7528\u8fd9\u4e2abutton\u6309\u94ae&#xff0c;\u52a0\u4e0a\u8fd9\u4e2aclass\u6837\u5f0fmy-button<\/p>\n<p><span class=\"token operator\">&lt;<\/span>van<span class=\"token operator\">&#8211;<\/span>button type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;primary&#034;<\/span> <span class=\"token keyword\">class<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;my-button&#034;<\/span><span class=\"token operator\">&gt;<\/span>\u4e3b\u8981\u6309\u94ae<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&gt;<\/span><\/p>\n<p>\u5728wxss\u6587\u4ef6\u4e2d&#xff0c;\u9700\u8981\u901a\u8fc7 \u2013color \u8bbe\u7f6e\u989c\u8272&#xff0c;\u5e76\u4e14\u8fd9\u4e2avan-button\u2013primary\u4e5f\u9700\u8981\u52a0\u4e0a<\/p>\n<p><span class=\"token punctuation\">.<\/span>my<span class=\"token operator\">&#8211;<\/span>button<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token operator\">&#8212;<\/span>color<span class=\"token operator\">:<\/span>lightseagreen <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token punctuation\">.<\/span>van<span class=\"token operator\">&#8211;<\/span>button<span class=\"token operator\">&#8212;<\/span>primary <span class=\"token punctuation\">{<\/span><br \/>\n  font<span class=\"token operator\">&#8211;<\/span>size<span class=\"token operator\">:<\/span> <span class=\"token number\">28<\/span>rpx <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  background<span class=\"token operator\">&#8211;<\/span>color<span class=\"token operator\">:<\/span> lightseagreen <span class=\"token operator\">!<\/span>important<span class=\"token punctuation\">;<\/span><br \/>\n  border<span class=\"token operator\">:<\/span> <span class=\"token number\">1<\/span>px solid lightseagreen <span class=\"token operator\">!<\/span>important<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>2&#xff0c;\u5206\u5305\u52a0\u8f7d<\/h3>\n<h4>2.1&#xff0c;\u5206\u5305\u52a0\u8f7d\u57fa\u672c\u4ecb\u7ecd<\/h4>\n<p>\u5c0f\u7a0b\u5e8f\u7684\u4ee3\u7801\u901a\u5e38\u77f3\u5934\u8bb8\u591a\u9875\u9762\u3001\u7ec4\u4ef6\u4ee5\u53ca\u8d44\u6e90\u7b49\u7ec4\u6210&#xff0c;\u968f\u7740\u5c0f\u7a0b\u5e8f\u529f\u80fd\u7684\u589e\u52a0&#xff0c;\u4ee3\u7801\u91cf\u4e5f\u4f1a\u589e\u52a0&#xff0c;\u4f53\u79ef\u8fc7\u5927\u5c31\u4f1a\u5bfc\u81f4\u7528\u6237\u6253\u5f00\u7684\u901f\u5ea6\u53d8\u6162&#xff0c;\u5f71\u54cd\u7528\u6237\u7684\u4f7f\u7528\u4f53\u9a8c\u3002\u5206\u5305\u52a0\u8f7d\u6307\u7684\u5c31\u662f\u5c0f\u7a0b\u5e8f\u5c06\u4e0d\u540c\u529f\u80fd\u7684\u4ee3\u7801&#xff0c;\u5206\u522b\u6253\u5305\u6210\u4e0d\u540c\u7684\u81ea\u7206&#xff0c;\u5728\u6784\u5efa\u65f6\u6253\u5305\u6210\u4e0d\u540c\u7684\u5206\u5305&#xff0c;\u7528\u6237\u5728\u4f7f\u7528\u65f6\u6309\u9700\u52a0\u8f7d\u3002<\/p>\n<p>\u6bcf\u4e2a\u4f7f\u7528\u5206\u5305\u7684\u5c0f\u7a0b\u5e8f\u4e00\u5b9a\u4f1a\u6709\u4e00\u4e2a\u4e3b\u5305&#xff0c;\u4e3b\u5305\u9ed8\u8ba4\u5305\u542b\u542f\u52a8\u9875\u9762\u3001Tarbar\u9875\u9762\u4ee5\u53ca\u6240\u6709\u5206\u5305\u6240\u9700\u7684\u516c\u5171\u8d44\u6e90\u5305&#xff1b;\u5206\u5305\u662f\u6839\u636e\u5f00\u53d1\u8005\u7684\u914d\u7f6e\u8fdb\u884c\u5212\u5206\u51fa\u6765\u7684\u5b50\u5305<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175956-689b811c68158.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u5728\u5c0f\u7a0b\u5e8f\u542f\u52a8\u65f6&#xff0c;\u9ed8\u8ba4\u4f1a\u4e0b\u8f7d\u4e3b\u5305\u5e76\u542f\u52a8\u4e3b\u5305\u5185\u9875\u9762&#xff0c;\u5f53\u7528\u6237\u8fdb\u5165\u5206\u5305\u5185\u7684\u67d0\u4e2a\u9875\u9762\u65f6&#xff0c;\u5fae\u4fe1\u5ba2\u6237\u7aef\u4f1a\u628a\u5bf9\u5e94\u7684\u5206\u5305\u4e0b\u8f7d\u4e0b\u6765&#xff0c;\u4e0b\u8f7d\u5b8c\u6210\u4e4b\u540e\u8fdb\u884c\u5c55\u793a\u3002<\/p>\n<p>\u76ee\u524d\u5c0f\u7a0b\u5e8f\u5206\u5305\u5927\u5c0f\u6709\u4ee5\u4e0b\u9650\u5236&#xff1a;\u6574\u4e2a\u5c0f\u7a0b\u5e8f\u6240\u6709\u5206\u5305\u5927\u5c0f\u4e0d\u8d85\u8fc720M\u3001\u5355\u4e2a\u5206\u5305\u6216\u8005\u4e3b\u5305\u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc720M<\/p>\n<h4>2.2&#xff0c;\u5206\u5305\u914d\u7f6e\u4ee5\u53ca\u6253\u5305\u5f15\u7528\u539f\u5219<\/h4>\n<p>\u63a5\u4e0b\u6765\u8bb2\u89e3\u4e00\u4e0b\u8fd9\u4e2a\u5206\u5305\u5177\u4f53\u662f\u5982\u4f55\u4f7f\u7528\u7684&#xff0c;\u9996\u5148\u5728miniprogram\u4e2d\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939modules&#xff0c;\u7136\u540e\u518d\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2achildModules\u6587\u4ef6\u5939\u3002<\/p>\n<p>\u968f\u540e\u5728app.json\u6587\u4ef6\u4e2d&#xff0c;\u5728subPackages\u5c5e\u6027\u4e2d\u6dfb\u52a0\u5206\u5305&#xff0c;\u4e3b\u5305\u4e0d\u9700\u8981\u663e\u793a\u8bbe\u7f6e\u3002root\u524d\u9762\u4e0d\u9700\u8981.\/&#xff0c;\u76f4\u63a5\u8bbe\u7f6e\u76ee\u5f55\u5373\u53ef&#xff0c;name\u6307\u7684\u662f\u522b\u540d&#xff0c;pages\u4e2d\u8bbe\u7f6e\u7684\u662f\u54ea\u4e9b\u9875\u9762\u4f1a\u5728\u8fd9\u4e2a\u5206\u5305\u4e2d\u3002<\/p>\n<p><span class=\"token string\">&#034;subPackages&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n  <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;root&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token string\">&#034;modules\/childModules&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;childModules&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;pages&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n      <span class=\"token string\">&#034;pages\/list\/list&#034;<\/span><br \/>\n    <span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><\/p>\n<p>\u6e05\u9664\u7f13\u5b58\u91cd\u65b0\u7f16\u8bd1\u4e4b\u540e&#xff0c;\u5728\u8fd9childModules\u6587\u4ef6\u4e0b&#xff0c;\u5c31\u4f1a\u5c06\u8fd9\u4e2a\u5bf9\u5e94\u7684\u5185\u5bb9\u52a0\u8f7d\u5230\u8fd9\u4e2a\u5206\u5305\u91cc\u9762\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175956-689b811cc175f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5728\u8be6\u60c5\u4e0b\u7684\u4ee3\u7801\u4f9d\u8d56\u5206\u6790\u4e2d&#xff0c;\u67e5\u770b\u4e3b\u5305\u548c\u5206\u5305\u7684\u4f9d\u8d56\u5173\u7cfb<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175957-689b811d1e1ad.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u6253\u5305\u539f\u5219\u4e3b\u8981\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>tarBar\u9875\u9762\u5fc5\u987b\u5728\u4e3b\u5305\u5185<\/li>\n<li>\u6700\u5916\u5c42\u7684pages\u5b57\u6bb5&#xff0c;\u5c5e\u4e8e\u4e3b\u5305\u7684\u5305\u542b\u7684\u9875\u9762<\/li>\n<li>\u6309subpackages\u914d\u7f6e\u8def\u5f84\u8fdb\u884c\u6253\u5305&#xff0c;\u914d\u7f6e\u8def\u5f84\u7684\u76ee\u5f55\u5c06\u88ab\u6253\u5305\u5230\u4e3b\u5305\u4e2d<\/li>\n<li>\u5206\u5305\u4e4b\u95f4\u4e0d\u80fd\u76f8\u4e92\u5d4c\u5957&#xff0c;subpackage\u7684\u6839\u76ee\u5f55\u4e0d\u80fd\u662f\u53e6\u5916\u4e00\u4e2asubpackage\u7684\u5b50\u76ee\u5f55<\/li>\n<\/ul>\n<p>\u5f15\u7528\u539f\u5219\u4e3b\u8981\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u4e3b\u5305\u4e0d\u53ef\u4ee5\u5f15\u7528\u5206\u5305\u7684\u8d44\u6e90&#xff0c;\u4f46\u5206\u5305\u53ef\u4ee5\u5f15\u7528\u4e3b\u5305\u7684\u516c\u5171\u8d44\u6e90<\/li>\n<li>\u5206\u5305\u4e0e\u5206\u5305\u4e4b\u95f4\u8d44\u6e90\u65e0\u6cd5\u76f8\u4e92\u5f15\u7528&#xff0c;\u5206\u5305\u5f02\u6b65\u5316\u65f6\u4e0d\u53d7\u6b64\u6761\u9650\u5236<\/li>\n<\/ul>\n<h4>2.3&#xff0c;\u72ec\u7acb\u5206\u5305<\/h4>\n<p>\u72ec\u7acb\u5206\u5305\u6307\u7684\u662f\u72ec\u7acb\u4e8e\u4e3b\u5305\u548c\u5176\u4ed6\u5206\u5305\u8fd0\u884c\u7684\u5305&#xff0c;\u72ec\u7acb\u5206\u5305\u9875\u9762\u8fdb\u5165\u5c0f\u7a0b\u5e8f\u65f6&#xff0c;\u4e0d\u9700\u8981\u4e0b\u8f7d\u4e3b\u5305&#xff0c;\u56e0\u6b64\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53ef\u4ee5\u63d0\u5347\u9875\u9762\u7684\u542f\u52a8\u901f\u5ea6\u3002<\/p>\n<p>\u72ec\u7acb\u5206\u5305\u7684\u4f7f\u7528\u4e5f\u6bd4\u8f83\u7b80\u5355&#xff0c;\u5728\u4e0a\u9762\u8bbe\u7f6e\u5206\u5305\u7684\u57fa\u7840\u4e0a&#xff0c;\u5728\u6570\u7ec4\u5728\u52a0\u4e00\u4e2a\u5bf9\u8c61&#xff0c;\u5e76\u4e14\u8bbe\u7f6e\u8fd9\u4e2aindependent\u4e3atrue&#xff0c;\u90a3\u4e48\u8fd9\u4e2a\u5206\u5305\u5c31\u6210\u4e3a\u4e86\u72ec\u7acb\u5206\u5305<\/p>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string\">&#034;root&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token string\">&#034;modules\/cartModules&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;cartModules&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;pages&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token string\">&#034;pages\/cart\/cart&#034;<\/span><br \/>\n  <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;independent&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175958-689b811e11c7f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u70b9\u6709\u5982\u4e0b\u51e0\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u72ec\u7acb\u5206\u5305\u4e0d\u80fd\u4f9d\u8d56\u4e3b\u5305\u548c\u5176\u4ed6\u5206\u5305\u4e2d\u7684\u8d44\u6e90<\/li>\n<li>\u4e3b\u5305\u4e2d\u7684app.wxss\u5bf9\u72ec\u7acb\u5206\u5305\u65e0\u6548<\/li>\n<li>App\u53ea\u80fd\u5728\u4e3b\u5305\u5185\u5b9a\u4e49&#xff0c;\u72ec\u7acb\u5206\u5305\u4e2d\u4e0d\u80fd\u5b9a\u4e49App&#xff0c;\u4f1a\u9020\u6210\u65e0\u6cd5\u9884\u671f\u7684\u884c\u4e3a<\/li>\n<\/ul>\n<h4>2.4&#xff0c;\u5206\u5305\u9884\u4e0b\u8f7d<\/h4>\n<p>\u5206\u5305\u9884\u4e0b\u8f7d\u6307\u7684\u662f\u8bbf\u95ee\u5c0f\u7a0b\u5e8f\u67d0\u4e2a\u9875\u9762\u65f6&#xff0c;\u9884\u5148\u4e0b\u8f7d\u5176\u4ed6\u5206\u5305\u4e2d\u7684\u4ee3\u7801\u548c\u8d44\u6e90&#xff0c;\u5f53\u7528\u6237\u9700\u8981\u8bbf\u95ee\u5206\u5305\u4e2d\u7684\u9875\u9762\u65f6&#xff0c;\u5df2\u7ecf\u9884\u5148\u4e0b\u8f7d\u7684\u4ee3\u7801\u548c\u8d44\u6e90\u5219\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528&#xff0c;\u4ece\u800c\u63d0\u4f9b\u7528\u6237\u7684\u4f53\u9a8c<\/p>\n<p>\u5c0f\u7a0b\u5e8f\u7684\u5206\u5305\u4e0b\u8f7d\u9700\u8981\u5728app.json\u6587\u4ef6\u4e2d\u901a\u8fc7\u8fd9\u4e2apreloadRule\u8bbe\u7f6e\u89c4\u5219&#xff0c;\u4ee5\u4e0b\u5206\u522b\u6f14\u793a\u4e86\u5206\u5305\u9884\u4e0b\u8f7d\u548c\u72ec\u7acb\u5206\u5305\u9884\u4e0b\u8f7d&#xff0c;key\u6307\u7684\u662f\u9875\u9762\u8def\u5f84&#xff0c;value\u662f\u4e00\u4e2a\u5bf9\u8c61&#xff0c;network\u6307\u7684\u662f\u4efb\u610f\u7f51\u7edc\u4e0b\u8f7d\u8fd8\u662f\u5728wifi\u60c5\u51b5\u4e0b\u4e0b\u8f7d&#xff0c;packages\u6307\u7684\u662f\u5305\u522b\u540d<\/p>\n<p><span class=\"token string\">&#034;preloadRule&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string\">&#034;pages\/list\/list&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;network&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;all&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;packages&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;childModules&#034;<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string\">&#034;modules\/cartModules\/pages\/cart\/cart&#034;<\/span><span class=\"token operator\">:<\/span><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;network&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;all&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;packages&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;__APP__&#034;<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u8f93\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d<\/p>\n","protected":false},"author":2,"featured_media":54315,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[90,87,885,556,400,555],"topic":[],"class_list":["post-54325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-npm","tag-87","tag-885","tag-556","tag-400","tag-555"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/54325.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u8f93\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/54325.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-12T17:59:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175952-689b8118b3d4d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/54325.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/54325.html\",\"name\":\"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-12T17:59:59+00:00\",\"dateModified\":\"2025-08-12T17:59:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/54325.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/54325.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/54325.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/54325.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u8f93\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d","og_url":"https:\/\/www.wsisp.com\/helps\/54325.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-12T17:59:59+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250812175952-689b8118b3d4d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/54325.html","url":"https:\/\/www.wsisp.com\/helps\/54325.html","name":"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-12T17:59:59+00:00","dateModified":"2025-08-12T17:59:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/54325.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/54325.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/54325.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7bc7-06\u3011\u6df1\u5165\u7406\u89e3npm\u652f\u6301\u548c\u5206\u5305\u52a0\u8f7d"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/54325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=54325"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/54325\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/54315"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=54325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=54325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=54325"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=54325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}