{"id":68056,"date":"2017-12-27T01:40:37","date_gmt":"2017-12-26T17:40:37","guid":{"rendered":"http:\/\/www.xiaoyebailong.com\/?p=68056"},"modified":"2017-12-27T01:40:37","modified_gmt":"2017-12-26T17:40:37","slug":"%e5%9c%a8%e5%ae%9e%e9%99%85%e5%bc%80%e5%8f%91%e8%bf%87%e7%a8%8b%e4%b8%ad%e9%81%87%e5%88%b0-warning%ef%bc%9a-now-you-can-provide-attr-wxkey-for-a-wxfor-to-improve-performance-%e4%b8%8a","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2017\/12\/27\/68056.htm","title":{"rendered":"\u5728\u5b9e\u9645\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9047\u5230 warning\uff1a Now you can provide attr \"wx:key\" for a \"wx:for\" to improve performance. \u4e0a\u7f51\u67e5\u627e\u8d44\u6599\u4e0e\u67e5\u770b\u5b98\u65b9\u6587\u6863\u53d1\u73b0\u539f\u56e0\u5927\u81f4\u5982\u4e0b\uff1a"},"content":{"rendered":"<p><strong>\u5728\u5b9e\u9645\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9047\u5230 warning\uff1a Now you can provide attr &#8220;wx:key&#8221; for a &#8220;wx:for&#8221; to improve performance.<\/strong><\/p>\n<p><strong>\u4e0a\u7f51\u67e5\u627e\u8d44\u6599\u4e0e\u67e5\u770b\u5b98\u65b9\u6587\u6863\u53d1\u73b0\u539f\u56e0\u5927\u81f4\u5982\u4e0b\uff1a<\/strong><\/p>\n<p><strong>\u5b98\u65b9\u89e3\u91ca\uff1a<\/strong><\/p>\n<p><strong>wx:key<\/strong><\/p>\n<p>\u5982\u679c\u5217\u8868\u4e2d\u9879\u76ee\u7684\u4f4d\u7f6e\u4f1a\u52a8\u6001\u6539\u53d8\u6216\u8005\u6709\u65b0\u7684\u9879\u76ee\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\uff0c\u5e76\u4e14\u5e0c\u671b\u5217\u8868\u4e2d\u7684\u9879\u76ee\u4fdd\u6301\u81ea\u5df1\u7684\u7279\u5f81\u548c\u72b6\u6001\uff08\u5982 &lt;input\/&gt; \u4e2d\u7684\u8f93\u5165\u5185\u5bb9\uff0c&lt;switch\/&gt; \u7684\u9009\u4e2d\u72b6\u6001\uff09\uff0c\u9700\u8981\u4f7f\u7528 wx:key \u6765\u6307\u5b9a\u5217\u8868\u4e2d\u9879\u76ee\u7684\u552f\u4e00\u7684\u6807\u8bc6\u7b26\u3002<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>\u7f51\u4e0a\u8d44\u6599\uff1a<\/strong><\/p>\n<p><strong>wx:key \u7684\u503c\u4ee5\u4e24\u79cd\u5f62\u5f0f\u63d0\u4f9b<\/strong><\/p>\n<p>1\u3001wx:key=&#8221;property&#8221;\u00a0\u5176\u4e2dproperty\u662f\u4ee3\u8868\u5728 for \u5faa\u73af\u7684 array \u4e2d item \u7684\u67d0\u4e2a property\uff0c\u8be5 property \u7684\u503c\u9700\u8981\u662f\u5217\u8868\u4e2d\u552f\u4e00\u7684\u5b57\u7b26\u4e32\u6216\u6570\u5b57\uff0c\u4e14\u4e0d\u80fd\u52a8\u6001\u6539\u53d8\u3002\u7c7b\u4f3c\u4e8e\u5b57\u5178\u7684key\u503c<\/p>\n<p>2\u3001wx:key=&#8221;*this&#8221;\uff0c\u00a0\u4fdd\u7559\u5173\u952e\u5b57 *this \u4ee3\u8868\u5728 for \u5faa\u73af\u4e2d\u7684 item \u672c\u8eab\uff0c\u8fd9\u79cd\u8868\u793a\u9700\u8981 item \u672c\u8eab\u662f\u4e00\u4e2a\u552f\u4e00\u7684\u5b57\u7b26\u4e32\u6216\u8005\u6570\u5b57\uff0c\u5982\uff1a<\/p>\n<p>\u5f53\u6570\u636e\u6539\u53d8\u89e6\u53d1\u6e32\u67d3\u5c42\u91cd\u65b0\u6e32\u67d3\u7684\u65f6\u5019\uff0c\u4f1a\u6821\u6b63\u5e26\u6709 key \u7684\u7ec4\u4ef6\uff0c\u6846\u67b6\u4f1a\u786e\u4fdd\u4ed6\u4eec\u88ab\u91cd\u65b0\u6392\u5e8f\uff0c\u800c\u4e0d\u662f\u91cd\u65b0\u521b\u5efa\uff0c\u4ee5\u786e\u4fdd\u4f7f\u7ec4<\/p>\n<p>\u4ef6\u4fdd\u6301\u81ea\u8eab\u7684\u72b6\u6001\uff0c\u5e76\u4e14\u63d0\u9ad8\u5217\u8868\u6e32\u67d3\u65f6\u7684\u6548\u7387\u3002<\/p>\n<p>\u4e0d\u6dfb\u52a0wx:key\u60c5\u51b5\uff1a<\/p>\n<p>&lt;block wx:for-items=&#8221;{{userInfoList}}&#8221; &gt;\uff0c\u4f1a\u51fa\u73b0warning\uff1a Now you can provide attr &#8220;wx:key&#8221; for a &#8220;wx:for&#8221; to improve performance.\u00a0\u5982\u679c\u660e\u786e\u77e5\u9053\u8be5\u5217\u8868\u662f\u9759\u6001\uff0c\u6216\u8005\u4e0d\u5fc5\u5173\u6ce8\u5176\u987a\u5e8f\uff0c\u53ef\u4ee5\u9009\u62e9\u5ffd\u7565\u3002<\/p>\n<p><strong>\u63a8\u8350array \u7684 \u6bcf\u4e00\u4e2aitem\u90fd\u6dfb\u52a0\u4e00\u4e2a\u552f\u4e00\u8bc6\u522b\u7684property\u6765\u7ba1\u7406<\/strong>\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u53bb\u6389warning\uff0c\u5982\u679c\u4f7f\u7528\u4fdd\u7559\u5173\u952e\u5b57\uff0c\u597d\u50cf\u4f1a\u51fa\u73b0\u663e\u793a\u7684item\u90fd\u662f\u6700\u540e\u4e00\u4e2a\u7684<\/p>\n<p>&lt;block wx:for-items=&#8221;{{userInfoList}}&#8221; wx:key=&#8221;userInfoListId&#8221;&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5b9e\u9645\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9047\u5230 warning\uff1a Now you can provide attr &#8220;wx:key&#8221; for a &#8220;wx:for&#8221; to improve performance. \u4e0a\u7f51\u67e5&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[381],"topic":[],"class_list":["post-68056","post","type-post","status-publish","format-standard","hentry","category-technology","tag-wx"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=68056"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68056\/revisions"}],"predecessor-version":[{"id":68057,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68056\/revisions\/68057"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=68056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=68056"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=68056"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=68056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}