{"id":1893,"date":"2024-11-10T09:32:41","date_gmt":"2024-11-10T01:32:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/1893\/"},"modified":"2024-11-10T09:32:41","modified_gmt":"2024-11-10T01:32:41","slug":"vue-%e7%88%b6%e7%bb%84%e4%bb%b6%e5%a6%82%e4%bd%95%e4%bc%a0%e9%80%92-map-%e7%b1%bb%e5%9e%8b%e5%8f%98%e9%87%8f%e5%88%b0%e5%ad%90%e7%bb%84%e4%bb%b6%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/1893\/","title":{"rendered":"Vue \u7236\u7ec4\u4ef6\u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173061131557409.jpg\" class=\"aligncenter\" title=\"Vue \u7236\u7ec4\u4ef6\u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f\u63d2\u56fe\" alt=\"Vue \u7236\u7ec4\u4ef6\u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f<\/strong><\/p>\n<p>\u5728 Vue \u4e2d\uff0c\u5982\u679c\u60a8\u5728\u7236\u7ec4\u4ef6\u4e2d\u5b9a\u4e49\u4e86\u4e00\u4e2a map \u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u5e76\u5e0c\u671b\u5728\u5b50\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u5b83\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3a Vue \u65e0\u6cd5\u5728\u7ec4\u4ef6\u4e4b\u95f4\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u3002<\/p>\n<p><strong>\u8d4b\u503c<\/strong><\/p>\n<p>\u5728\u7236\u7ec4\u4ef6\u4e2d\u58f0\u660e map \u7c7b\u578b\u7684\u53d8\u91cf\uff1a<\/p>\n<pre>export default {\n  data() {\n    return {\n      roomPictureList: {}\n    }\n  }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f20\u9012<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5728\u5b50\u7ec4\u4ef6\u4e2d\u5c1d\u8bd5\u4f7f\u7528\u7236\u7ec4\u4ef6\u7684\u53d8\u91cf\uff1a<\/p>\n<pre>&lt;template&gt;\n  &lt;div&gt;\n    {{ roomPictureList }}\n  &lt;\/div&gt;\n&lt;\/template&gt;\n\n&lt;script&gt;\nimport { useRoom } from '\/composables\/useRoom'\n\nexport default {\n  setup() {\n    const { roomPictureList } = useRoom()\n    return { roomPictureList }\n  }\n}\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63a7\u5236\u53f0<\/strong><\/p>\n<p>\u60a8\u53ef\u80fd\u4f1a\u5728\u63a7\u5236\u53f0\u770b\u5230\u4e00\u4e2a\u9519\u8bef\uff0c\u7c7b\u4f3c\u4e8e\uff1a<\/p>\n<pre>[Vue warn]: Property \"roomPictureList\" was accessed during render but is not defined on instance.<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u539f\u56e0<\/strong><\/p>\n<p>\u6b64\u9519\u8bef\u662f\u7531\u4e8e roomPictureList \u7684\u521d\u59cb\u503c\u662f\u7a7a map\uff0c\u800c\u4e0d\u662f null\u3002\u8fd9\u610f\u5473\u7740 Vue \u65e0\u6cd5\u8ddf\u8e2a map \u7684\u66f4\u65b0\uff0c\u56e0\u4e3a\u5b83\u5c06\u5176\u89c6\u4e3a undefined \u800c\u4e0d\u662f\u4e00\u4e2a\u53ef\u53d8\u5bf9\u8c61\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u60a8\u53ef\u4ee5\u5c06 roomPictureList \u7684\u521d\u59cb\u503c\u66f4\u6539\u4e3a null\uff1a<\/p>\n<pre>export default {\n  data() {\n    return {\n      roomPictureList: null\n    }\n  }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u505a\u5c06\u5141\u8bb8 Vue \u8ffd\u8e2a map \u7684\u66f4\u65b0\uff0c\u5e76\u5141\u8bb8\u60a8\u5728\u5b50\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u5b83\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fVue \u7236\u7ec4\u4ef6\u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u5230\u5b50\u7ec4\u4ef6\uff1f \u5728 Vue \u4e2d\uff0c\u5982\u679c\u60a8\u5728\u7236\u7ec4\u4ef6\u4e2d\u5b9a\u4e49\u4e86\u4e00\u4e2a map \u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u5e76\u5e0c\u671b\u5728\u5b50\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u5b83\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3a Vue \u65e0\u6cd5\u5728\u7ec4\u4ef6\u4e4b\u95f4\u4f20\u9012 map \u7c7b\u578b\u53d8\u91cf\u3002 \u8d4b\u503c \u5728\u7236\u7ec4\u4ef6\u4e2d\u58f0\u660e map \u7c7b\u578b\u7684\u53d8\u91cf\uff1a export default { data() { return { roomPictureList: {} } } } \u767b\u5f55\u540e\u590d\u5236 \u4f20\u9012 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5728\u5b50\u7ec4\u4ef6\u4e2d\u5c1d\u8bd5\u4f7f\u7528\u7236\u7ec4\u4ef6\u7684\u53d8\u91cf\uff1a &lt;template&gt; &lt;div&gt; {{ roomPictureList }} &lt;\/div&gt; &lt;\/template&gt; &lt;script&gt; import { useRoom } from &#8216;\/composables\/useRoom&#8217; export default { setup() { const { roomPictureList } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1893","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=1893"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1893\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=1893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=1893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=1893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}