{"id":112,"date":"2021-01-18T20:44:33","date_gmt":"2021-01-18T12:44:33","guid":{"rendered":"http:\/\/gjweb.top\/?p=112"},"modified":"2021-01-18T20:44:35","modified_gmt":"2021-01-18T12:44:35","slug":"v-for%e6%b8%b2%e6%9f%93%e5%ae%8c%e6%88%90%e5%90%8e%e8%a7%a6%e5%8f%91%e5%9b%9e%e8%b0%83","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=112","title":{"rendered":"v-for\u6e32\u67d3\u5b8c\u6210\u540e\u89e6\u53d1\u56de\u8c03"},"content":{"rendered":"\n<p>\u95ee\u9898\u63cf\u8ff0\uff1a\u5728\u4f7f\u7528v-for\u5faa\u73af\u9875\u9762\u6e32\u67d3\u65f6\uff0c\u540c\u65f6\u83b7\u53d6\u6e32\u67d3\u5143\u7d20\u662f\u4e3anull\u3002<\/p>\n\n\n\n<p>\u539f\u56e0\uff1av-for\u672a\u6e32\u67d3\u5b8c\u6210\u3002<\/p>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6cd5\u4e00\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5229\u7528wacth+this.$nextTick\u65b9\u5f0f\u89e3\u51b3<\/li><li>wacth \u76d1\u542c\u67d0\u4e00\u4e2adata\u6570\u636e\u53d1\u751f\u53d8\u5316\u5c31\u6267\u884c\u65b9\u6cd5<\/li><li>nextTick:\u5728\u4e0b\u6b21DOM\u66f4\u65b0\u5faa\u73af\u7ed3\u675f\u4e4b\u540e\u6267\u884c\u56de\u8c03<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;template&gt;\n    &lt;div v-for=\"(tiem,index) in test\" :key=\"index\"&gt;&lt;\/div&gt;\n&lt;\/template&gt;\n\n&lt;script&gt;\n    export default {\n        data(){\n            return{\n                test:&#91;]\n            }\n        },\n        watch:{\n            test(){\n                this.$nextTick(()=&gt;{\n                    console.log(\"v-for\u6e32\u67d3\u5b8c\u6210,\u53ef\u901a\u8fc7\u56de\u8c03\u51fd\u6570\u6267\u884c\u64cd\u4f5c\")\n                })\n            }\n        },\n        mounted(){\n            this.$axios({\n                mounteds:'get',\n                url:''\n            }).then((response)=&gt;{\n                this.test = response;\n            })\n        }\n    }\n\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6cd5\u4e8c:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5728\u56de\u8c03\u65b9\u6cd5\u4e2d\u8c03\u7528\u4e00\u6b21\u6027\u5b9a\u65f6\u5668<\/li><li>\u5229\u7528\u5b9a\u65f6\u5668\u9884\u7559\u51fa\u9875\u9762\u7684\u6e32\u67d3\u65f6\u95f4,\u5728\u6267\u884c\u65b9\u6cd5.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;template&gt;\n    &lt;div v-for=\"(tiem,index) in test\" :key=\"index\"&gt;&lt;\/div&gt;\n&lt;\/template&gt;\n\n&lt;script&gt;\n    export default {\n        data:{\n            return:{\n                test:&#91;]\n            }\n        },\n        mounted(){\n            this.$axios({\n                mounteds:'get',\n                url:''\n            }).then((response)=&gt;{\n                this.test = response;\n                this.testFun()\n            })\n        },\n        methods:{\n            testFun(){\n                setTimeout(()=&gt;{\n                    console.log('\u9884\u7559\u65b9\u6cd5\u8c03\u7528\u7684\u65f6\u95f4,\u7b49v-for\u6e32\u67d3\u5b8c\u6210\u5728\u6267\u884c')\n                },2000)\n            }\n        }\n    }\n&lt;\/script&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u63cf\u8ff0\uff1a\u5728\u4f7f\u7528v-for\u5faa\u73af\u9875\u9762\u6e32\u67d3\u65f6\uff0c\u540c\u65f6\u83b7\u53d6\u6e32\u67d3\u5143\u7d20\u662f\u4e3anull\u3002 \u539f\u56e0\uff1av-for\u672a\u6e32\u67d3\u5b8c\u6210\u3002 \u89e3\u51b3\u65b9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-112","post","type-post","status-publish","format-standard","hentry","category-vue"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=112"}],"version-history":[{"count":0,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/112\/revisions"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}