{"id":52321,"date":"2024-12-03T10:40:03","date_gmt":"2024-12-03T02:40:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52321\/"},"modified":"2024-12-03T10:40:03","modified_gmt":"2024-12-03T02:40:03","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-vue-%e5%ae%9e%e7%8e%b0%e5%8f%8c%e5%9b%be%e7%89%87%e5%90%88%e5%b9%b6%e5%b9%b6%e9%80%82%e9%85%8d%e4%b8%8d%e5%90%8c%e9%a1%b5%e9%9d%a2%e5%a4%a7%e5%b0%8f%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52321\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f <\/h1>\n<p><span style=\"font-size: 15px\">\u6709\u5fd7\u8005\uff0c\u4e8b\u7adf\u6210\uff01\u5982\u679c\u4f60\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u90a3\u4e48\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f \u300b<\/span>\uff0c\u5c31\u5f88\u9002\u5408\u4f60\uff01\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241120\/1732062463673d2cff57656.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>vue\u4e2d\u53cc\u56fe\u7247\u5408\u5e76\u4e14\u9002\u914d\u9875\u9762\u5927\u5c0f<\/strong><\/p>\n<p>\u4e3a\u4e86\u5c06\u4e24\u5f20\u56fe\u7247\u5408\u5e76\u5e76\u5728\u4e0d\u540c\u9875\u9762\u5927\u5c0f\u4e0b\u4fdd\u6301\u9002\u5e94\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<p>\u9996\u5148\uff0c\u4f7f\u7528\u52a8\u6001\u5355\u4f4d\u914d\u5408\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u3002\u52a8\u6001\u5355\u4f4d\u5305\u62ec<strong>vw<\/strong>\uff08\u6d4f\u89c8\u5668\u53ef\u89c6\u5bbd\u5ea6\u7684\u767e\u5206\u6bd4\uff09\u548c<strong>rem<\/strong>\uff08\u4f9d\u8d56\u4e8e\u9875\u9762\u6839\u8282\u70b9<strong>html<\/strong>\u7684\u5b57\u4f53\u5927\u5c0f\uff09\u3002<\/p>\n<p>\u4f7f\u7528<strong>rem<\/strong>\u52a8\u6001\u8bbe\u7f6e\u65b9\u6cd5\u4e4b\u4e00\uff1a<\/p>\n<pre>function refreshRem() {\n  const whdef = 100 \/ 750;\n  const bodyWidth = document.body.clientWidth;\n  const rem = whdef * bodyWidth;\n  document.getElementsByTagName('html')['0'].style.fontSize = `${rem}px`;\n}<\/pre>\n<p>\u5176\u6b21\uff0c\u5b9e\u73b0\u8f93\u5165\u6846\u6837\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528<strong>css<\/strong>\u8f7b\u677e\u5b9e\u73b0\uff0c\u5305\u62ec\u80cc\u666f\u8272\u3001\u9634\u5f71\u548c\u5706\u89d2\uff1a<\/p>\n<pre>.input {\n  width: 20vw;\n  height: 3vw;\n  line-height: 3vw;\n  font-size: 1.5vw;\n  border: none;\n  outline: none;\n  border-radius: 2vw;\n  background: url(path\/to\/image.png) #fefdd7 17vw center\/2vw 2vw no-repeat;\n  box-shadow: 0 3px 0 0 #705048;\n  position: relative;\n  box-sizing: border-box;\n  padding: 0 4vw 0 2vw;\n}<\/pre>\n<p>\u6548\u679c\u5c55\u793a\uff1a<\/p>\n<p>[\u56fe\u7247]<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f \u300b\u7684\u5185\u5bb9\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\uff0c\u5982\u679c\u6709\u4ec0\u4e48\u7591\u95ee\u6216\u8005\u5efa\u8bae\uff0c\u53ef\u4ee5\u5728\u7c73\u4e91\u516c\u4f17\u53f7\u4e0b\u591a\u591a\u56de\u590d\u4ea4\u6d41\uff1b\u6587\u4e2d\u82e5\u6709\u4e0d\u6b63\u4e4b\u5904\uff0c\u4e5f\u5e0c\u671b\u56de\u590d\u7559\u8a00\u4ee5\u544a\u77e5\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u9b45\u84ddnote2\u6295\u5c04\u5c4f\u5e55\u4e3a\u4ec0\u4e48\u641c\u7d22\u4e0d\u5230\u8bbe\u5907\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f \u6709\u5fd7\u8005\uff0c\u4e8b\u7adf\u6210\uff01\u5982\u679c\u4f60\u5728\u5b66\u4e60\u6587\u7ae0\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u4f7f\u7528 Vue \u5b9e\u73b0\u53cc\u56fe\u7247\u5408\u5e76\u5e76\u9002\u914d\u4e0d\u540c\u9875\u9762\u5927\u5c0f\uff1f \u300b\uff0c\u5c31\u5f88\u9002\u5408\u4f60\uff01\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~ vue\u4e2d\u53cc\u56fe\u7247\u5408\u5e76\u4e14\u9002\u914d\u9875\u9762\u5927\u5c0f \u4e3a\u4e86\u5c06\u4e24\u5f20\u56fe\u7247\u5408\u5e76\u5e76\u5728\u4e0d\u540c\u9875\u9762\u5927\u5c0f\u4e0b\u4fdd\u6301\u9002\u5e94\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u9996\u5148\uff0c\u4f7f\u7528\u52a8\u6001\u5355\u4f4d\u914d\u5408\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u3002\u52a8\u6001\u5355\u4f4d\u5305\u62ecvw\uff08\u6d4f\u89c8\u5668\u53ef\u89c6\u5bbd\u5ea6\u7684\u767e\u5206\u6bd4\uff09\u548crem\uff08\u4f9d\u8d56\u4e8e\u9875\u9762\u6839\u8282\u70b9html\u7684\u5b57\u4f53\u5927\u5c0f\uff09\u3002 \u4f7f\u7528rem\u52a8\u6001\u8bbe\u7f6e\u65b9\u6cd5\u4e4b\u4e00\uff1a function refreshRem() { const whdef = 100 \/ 750; const bodyWidth = document.body.clientWidth; const rem = whdef * bodyWidth; document.getElementsByTagName(&#8216;html&#8217;)[&#8216;0&#8217;].style.fontSize = `${rem}px`; } \u5176\u6b21\uff0c\u5b9e\u73b0\u8f93\u5165\u6846\u6837\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528css\u8f7b\u677e\u5b9e\u73b0\uff0c\u5305\u62ec\u80cc\u666f\u8272\u3001\u9634\u5f71\u548c\u5706\u89d2\uff1a .input { width: 20vw; height: 3vw; line-height: 3vw; font-size: 1.5vw; border: none; outline: none; border-radius: 2vw; background: url(path\/to\/image.png) #fefdd7 17vw [&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-52321","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52321","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=52321"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52321\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}