{"id":10586,"date":"2022-11-10T11:27:54","date_gmt":"2022-11-10T03:27:54","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=10586"},"modified":"2022-11-10T11:52:25","modified_gmt":"2022-11-10T03:52:25","slug":"select","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2022\/11\/10\/select\/","title":{"rendered":"vue\u4e2dselect\u4e0b\u62c9\u6846\u8fdc\u7a0b\u8c03\u7528\u6570\u636e"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4ee5\u8fd0\u7ef4\u5e73\u53f0\u4e2d\u95f4\u4ef6\u7ba1\u7406\u6a21\u5757\u4e3a\u4f8b\u5b50\uff0c\u70b9\u51fb\u6dfb\u52a0\u6309\u94ae\u540e\u5f39\u51fa\u6dfb\u52a0\u4e2d\u95f4\u4ef6\u7a97\u53e3\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"275\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/1-6.png\" alt=\"\" class=\"wp-image-10587\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/1-6.png 719w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/1-6-300x115.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/1-6-600x229.png 600w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u9009\u62e9\u4e2d\u95f4\u4ef6\u6240\u5728\u7684IP\u5730\u5740\u540e\uff0c\u6700\u7ec8\u663e\u793a\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"361\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/2-7.png\" alt=\"\" class=\"wp-image-10588\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/2-7.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/2-7-300x153.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/2-7-600x306.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\uff1a\u4e0a\u9762\u7684\u5f39\u7a97\u4e2d\u5b9e\u9645\u5d4c\u5957\u7684\u662f\u8868\u5355<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u89e3\u51b3\u601d\u8def\uff1a\u5728\u4e2d\u95f4\u4ef6\u7ba1\u7406\u9875\u9762\uff0c\u5185\u5bb9\u662f\u4ee5\u8868\u683c\u7684\u5f62\u5f0f\u5c55\u73b0\u7684\uff0c\u56e0\u6b64\u5728\u6dfb\u52a0\u4e2d\u95f4\u4ef6\u540e\uff0c\u6570\u636e\u90fd\u662f\u586b\u5165\u5230\u8868\u683c\u4e2d\uff0c\u56e0\u6b64\u70b9\u51fb\u6dfb\u52a0\u6309\u94ae\u540e\uff0c\u53ef\u5148\u8c03\u7528\u6dfb\u52a0\u6309\u94ae\u5bf9\u5e94\u7684\u51fd\u6570\uff0c\u53bb\u6570\u636e\u5e93\u4e2d\u83b7\u53d6IP\u5730\u5740\u6570\u636e\uff0c\u7136\u540e\u5c06\u83b7\u53d6\u5230\u7684\u6570\u636e\u8d4b\u503c\u7ed9select\u4e2d\u7684options\u5bf9\u5e94\u7684\u53d8\u91cf(IP\u5730\u5740\u662f\u5df2\u7ecf\u5b58\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u672c\u4f8b\u5b50\u4e2d\u662f\u901a\u8fc7agent\u91c7\u96c6\u7136\u540e\u66f4\u65b0\u5230\u6570\u636e\u5e93\u4e2d\u7684)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5b9e\u73b0\u65b9\u6cd5\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u770b\u4e0b\u6dfb\u52a0\u6309\u94ae\u5bf9\u5e94\u7684\u51fd\u6570\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"255\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/4-5.png\" alt=\"\" class=\"wp-image-10593\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/4-5.png 710w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/4-5-300x108.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/4-5-600x215.png 600w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u672c\u4f8b\u5b50\u4e2d\u65b0\u589e\u548c\u7f16\u8f91\u90fd\u8c03\u7528\u540c\u4e00\u4e2a\u51fd\u6570\uff0c\u518d\u6b64\u4e0d\u8ba8\u8bba\u7f16\u8f91\uff0c\u53ea\u770b\u65b0\u589e\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"624\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/5-4.png\" alt=\"\" class=\"wp-image-10594\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/5-4.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/5-4-300x264.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/5-4-600x529.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u770b\u51fa\uff0c\u5728\u65b0\u589e\u9875\u9762\uff0c\u4e5f\u5c31\u662f\u6dfb\u52a0\u9875\u9762\uff0c\u8c03\u7528getList()\u51fd\u6570\uff0c\u6b64\u51fd\u6570\u901a\u8fc7gethost\u8c03\u7528\u540e\u53f0\u63a5\u53e3\u83b7\u53d6IP\u4fe1\u606f\uff0cresponse.data.List\u8868\u793a\u8fd4\u56de\u7684\u6570\u636e\u7ed9options\uff0c\u770b\u4e0bdata.List\u7684\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"392\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/6-3.png\" alt=\"\" class=\"wp-image-10595\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/6-3.png 710w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/6-3-300x166.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/6-3-600x331.png 600w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u67e5\u770bselect\u6807\u7b7e\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"227\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/7-2.png\" alt=\"\" class=\"wp-image-10597\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/7-2.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/7-2-300x96.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/7-2-600x192.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>item in options\uff1a\u8868\u793a\u904d\u5386\u5207\u7247options\u4e2d\u7684\u6570\u636e\u5230item\u4e2d<\/li><li>key\uff1a\u552f\u4e00\u6807\u8bc6\uff0c\u6700\u597d\u8981\u5199<\/li><li>label: \u9009\u9879\u6807\u7b7e\uff0c\u5982\u679c\u4e0d\u5199\u9ed8\u8ba4\u4e0evalue\u76f8\u540c<\/li><li>value\uff1a\u83b7\u53d6\u7684\u503c<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u7b2c\u4e00\u6b65\u4e2d\u5c06\u83b7\u53d6\u7684\u6570\u636e\u8d4b\u503c\u7ed9\u4e86options\uff0c\u6b64\u65f6options\u7684\u5185\u5bb9\u5c31\u662fdata.List\u4e2d\u7684\u5185\u5bb9\uff0citem\u53c8\u662f\u904d\u5386options\u7684\u53d8\u91cf\uff0c\u56e0\u6b64\u83b7\u53d6IP\u4fe1\u606f\u53ea\u9700\u8981\u901a\u8fc7item.ip\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\u610f\uff1a\u5728return\u4e2d\u8981\u6307\u5b9aoptions\u7684\u9ed8\u8ba4\u503c\u4e3a\u7a7a\uff0c\u5426\u5219\u65e0\u6cd5\u9009\u62e9\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"461\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/8-2.png\" alt=\"\" class=\"wp-image-10599\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/8-2.png 710w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/8-2-300x195.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/11\/8-2-600x390.png 600w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u8fd0\u7ef4\u5e73\u53f0\u4e2d\u95f4\u4ef6\u7ba1\u7406\u6a21\u5757\u4e3a\u4f8b\u5b50\uff0c\u70b9\u51fb\u6dfb\u52a0\u6309\u94ae\u540e\u5f39\u51fa\u6dfb\u52a0\u4e2d\u95f4\u4ef6\u7a97\u53e3\uff0c\u5982\u56fe\uff1a \u9009\u62e9\u4e2d\u95f4\u4ef6\u6240\u5728\u7684IP\u5730\u5740\u540e\uff0c\u6700\u7ec8\u663e\u793a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":10589,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[155,23],"tags":[],"class_list":["post-10586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/10586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=10586"}],"version-history":[{"count":6,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/10586\/revisions"}],"predecessor-version":[{"id":10600,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/10586\/revisions\/10600"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/10589"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=10586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=10586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=10586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}