{"id":53322,"date":"2024-12-03T15:47:22","date_gmt":"2024-12-03T07:47:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53322\/"},"modified":"2024-12-03T15:47:22","modified_gmt":"2024-12-03T07:47:22","slug":"%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e7%bd%91%e9%a1%b5%e6%96%87%e5%ad%97%e5%8a%a8%e6%80%81%e7%9c%81%e7%95%a5%e6%95%88%e6%9e%9c%ef%bc%8c%e5%b9%b6%e4%bf%9d%e6%8c%81%e5%9b%be%e6%a0%87%e6%98%be%e7%a4%ba-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53322\/","title":{"rendered":"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f <\/h1>\n<p>\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u6211\u4eec\u8981\u52aa\u529b\u5b66\u4e60\u5566\uff01\u4eca\u5929\u6211\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f \u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4e0b\u6587\u4e2d\u7684\u5185\u5bb9\u6211\u4eec\u4e3b\u8981\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u5728\u9605\u8bfb\u672c\u6587\u8fc7\u7a0b\u4e2d\u6709\u9047\u5230\u4e0d\u6e05\u695a\u7684\u5730\u65b9\uff0c\u6b22\u8fce\u7559\u8a00\u5440\uff01\u6211\u4eec\u4e00\u8d77\u8ba8\u8bba\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241129\/17328546386749436e75693.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728\u7f51\u9875\u4e0a\u5b9e\u73b0\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff1f<\/strong><\/p>\n<p>\u5982\u4f55\u901a\u8fc7 CSS \u6216\u5c11\u91cf JS \u6765\u5b9e\u73b0\u7c7b\u4f3c\u4e8e\u4e0b\u56fe\u6240\u793a\u7684\u52a8\u6001\u6587\u672c\u7701\u7565\u6548\u679c\uff1f\u5176\u4e2d\uff0c\u52a8\u6001\u5185\u5bb9\u662f\u4e00\u4e2a\u56fe\u6807\uff0c\u6587\u672c\u957f\u5ea6\u53d8\u52a8\u65f6\u4e5f\u80fd\u4fdd\u6301\u826f\u597d\u7684\u663e\u793a\u72b6\u6001\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u7eaf CSS \u5b9e\u73b0\uff1a<\/strong><\/li>\n<\/ul>\n<pre>.ellipsis {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n.icon {\n  display: inline-block;\n  margin-left: 8px;\n}<\/pre>\n<p>\u6b64\u65b9\u6cd5\u901a\u8fc7\u8bbe\u7f6e overflow \u4e3a hidden \u548c text-overflow \u4e3a ellipsis \u6765\u9690\u85cf\u6ea2\u51fa\u7684\u6587\u672c\uff0c\u4f46\u5b83\u53ea\u9002\u7528\u4e8e\u6587\u672c\u957f\u5ea6\u56fa\u5b9a\u7684\u60c5\u51b5\u3002<\/p>\n<ul>\n<li><strong>\u5e26\u5c11\u91cf JS \u7684 CSS \u5b9e\u73b0\uff1a<\/strong><\/li>\n<\/ul>\n<pre>.ellipsis {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n.icon {\n  display: inline-block;\n  margin-left: 8px;\n}<\/pre>\n<pre>\/\/ \u83b7\u53d6\u6587\u672c\u8282\u70b9\u548c\u56fe\u6807\u8282\u70b9\nconst textNode = document.querySelector('.ellipsis');\nconst iconNode = document.querySelector('.icon');\n\n\/\/ \u76d1\u542c\u6587\u672c\u8282\u70b9\u7684\u6587\u672c\u5185\u5bb9\u53d8\u5316\u4e8b\u4ef6\ntextNode.addEventListener('DOMSubtreeModified', () =&gt; {\n  \/\/ \u6839\u636e\u6587\u672c\u5185\u5bb9\u7684\u957f\u5ea6\u8c03\u6574\u56fe\u6807\u7684\u4f4d\u7f6e\n  const textWidth = textNode.offsetWidth;\n  iconNode.style.left = `${textWidth + 8}px`;\n});<\/pre>\n<p>\u6b64\u65b9\u6cd5\u901a\u8fc7\u76d1\u542c\u6587\u672c\u8282\u70b9\u7684\u5185\u5bb9\u53d8\u5316\u4e8b\u4ef6\uff0c\u52a8\u6001\u8c03\u6574\u56fe\u6807\u7684\u4f4d\u7f6e\uff0c\u4ece\u800c\u5b9e\u73b0\u4e0d\u540c\u6587\u672c\u957f\u5ea6\u4e0b\u7684\u6b63\u786e\u663e\u793a\u3002<\/p>\n<p><strong>\u53c2\u8003\u6587\u7ae0\u53ca demo\uff1a<\/strong><\/p>\n<ul>\n<li>CodePen demo\uff1ahttps:\/\/codepen.io\/xboxyan\/pen\/PopWVNX<\/li>\n<li>\u6d6e\u52a8\u5e03\u5c40\u5b9e\u73b0\uff1ahttps:\/\/segmentfault.com\/a\/1190000040172089<\/li>\n<\/ul>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f \u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   445\u7aef\u53e3\u600e\u4e48\u5173\u95ed win11\u7cfb\u7edf\u5173\u95ed445\u7aef\u53e3\u7684\u65b9\u6cd5\u6559\u7a0b\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f \u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u6211\u4eec\u8981\u52aa\u529b\u5b66\u4e60\u5566\uff01\u4eca\u5929\u6211\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff0c\u5e76\u4fdd\u6301\u56fe\u6807\u663e\u793a\u6b63\u5e38\uff1f \u300b\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4e0b\u6587\u4e2d\u7684\u5185\u5bb9\u6211\u4eec\u4e3b\u8981\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u5728\u9605\u8bfb\u672c\u6587\u8fc7\u7a0b\u4e2d\u6709\u9047\u5230\u4e0d\u6e05\u695a\u7684\u5730\u65b9\uff0c\u6b22\u8fce\u7559\u8a00\u5440\uff01\u6211\u4eec\u4e00\u8d77\u8ba8\u8bba\uff0c\u4e00\u8d77\u5b66\u4e60\uff01 \u5982\u4f55\u5728\u7f51\u9875\u4e0a\u5b9e\u73b0\u6587\u5b57\u52a8\u6001\u7701\u7565\u6548\u679c\uff1f \u5982\u4f55\u901a\u8fc7 CSS \u6216\u5c11\u91cf JS \u6765\u5b9e\u73b0\u7c7b\u4f3c\u4e8e\u4e0b\u56fe\u6240\u793a\u7684\u52a8\u6001\u6587\u672c\u7701\u7565\u6548\u679c\uff1f\u5176\u4e2d\uff0c\u52a8\u6001\u5185\u5bb9\u662f\u4e00\u4e2a\u56fe\u6807\uff0c\u6587\u672c\u957f\u5ea6\u53d8\u52a8\u65f6\u4e5f\u80fd\u4fdd\u6301\u826f\u597d\u7684\u663e\u793a\u72b6\u6001\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u7eaf CSS \u5b9e\u73b0\uff1a .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .icon { display: inline-block; margin-left: 8px; } \u6b64\u65b9\u6cd5\u901a\u8fc7\u8bbe\u7f6e overflow \u4e3a hidden \u548c text-overflow \u4e3a ellipsis \u6765\u9690\u85cf\u6ea2\u51fa\u7684\u6587\u672c\uff0c\u4f46\u5b83\u53ea\u9002\u7528\u4e8e\u6587\u672c\u957f\u5ea6\u56fa\u5b9a\u7684\u60c5\u51b5\u3002 \u5e26\u5c11\u91cf JS \u7684 CSS \u5b9e\u73b0\uff1a .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .icon { display: [&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-53322","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53322","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=53322"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53322\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}