{"id":25975,"date":"2024-11-24T10:07:54","date_gmt":"2024-11-24T02:07:54","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25975\/"},"modified":"2024-11-24T10:07:54","modified_gmt":"2024-11-24T02:07:54","slug":"element-ui-%e6%8c%89%e9%92%ae%e7%82%b9%e5%87%bb%e5%90%8e%e5%a6%82%e4%bd%95%e8%ae%a9%e8%83%8c%e6%99%af%e8%89%b2%e8%87%aa%e5%8a%a8%e6%b6%88%e5%a4%b1%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25975\/","title":{"rendered":"Element UI \u6309\u94ae\u70b9\u51fb\u540e\u5982\u4f55\u8ba9\u80cc\u666f\u8272\u81ea\u52a8\u6d88\u5931\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173076858452700.jpg\" class=\"aligncenter\" title=\"Element UI \u6309\u94ae\u70b9\u51fb\u540e\u5982\u4f55\u8ba9\u80cc\u666f\u8272\u81ea\u52a8\u6d88\u5931\uff1f\u63d2\u56fe\" alt=\"Element UI \u6309\u94ae\u70b9\u51fb\u540e\u5982\u4f55\u8ba9\u80cc\u666f\u8272\u81ea\u52a8\u6d88\u5931\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>element ui \u6309\u94ae\u70b9\u51fb\u540e\u80cc\u666f\u8272\u5982\u4f55\u968f\u9f20\u6807\u79fb\u5f00\u800c\u6d88\u5931\uff1f<\/strong><\/p>\n<p>\u5f53\u4f7f\u7528 element ui \u5e26\u6709 :focus \u7684\u6309\u94ae\u65f6\uff0c\u6309\u94ae\u5728\u88ab\u70b9\u51fb\u540e\u4f1a\u4fdd\u6301\u80cc\u666f\u8272\u3002\u8981\u8ba9\u80cc\u666f\u8272\u968f\u7740\u9f20\u6807\u79fb\u5f00\u800c\u6d88\u5931\uff0c\u53ef\u4ee5\u6709\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ol>\n<li><strong>blur \u6309\u94ae\u5143\u7d20<\/strong><\/li>\n<\/ol>\n<pre>clickhandler(evt) {\n    let target = evt.target;\n    if(target.nodename == \"span\"){\n        target = evt.target.parentnode;\n    }\n    target.blur();\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li><strong>\u91cd\u5199  \u6837\u5f0f<\/strong><\/li>\n<\/ol>\n<p>\u901a\u8fc7\u91cd\u5199 css \u6837\u5f0f\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6309\u94ae\u5728\u4e0d\u540c\u72b6\u6001\u4e0b\u7684\u5916\u89c2\u3002<\/p>\n<pre>&lt;el-button class=\"buttondiv\" size=\"small\"&gt;\u67e5\u8be2&lt;\/el-button&gt;\n&lt;el-button class=\"buttondiv\" size=\"small\"&gt;\u91cd\u7f6e&lt;\/el-button&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>\/*\u9f20\u6807\u70b9\u51fb\u540e\u79fb\u5f00\uff0c\u6062\u590d\u672c\u8eab\u6837\u5f0f*\/\n.buttonDiv, .buttonDiv:focus:not(.buttonDiv:hover){ \n    ... \/\/ \u5176\u4ed6\u6837\u5f0f\n}\n\/*\u9f20\u6807\u60ac\u6d6e\uff0c\u6ca1\u6709\u6309\u4e0b\uff1b\u9f20\u6807\u6309\u4e0b\u540e\u62ac\u8d77\uff0c\u6ca1\u6709\u79fb\u5f00*\/\n.buttonDiv:focus, .buttonDiv:hover{\n    background: #eaf5ff;\n    ... \/\/ \u5176\u4ed6\u6837\u5f0f\n}\n\/*\u9f20\u6807\u6309\u4e0b\uff0c\u6ca1\u6709\u62ac\u8d77*\/\n.buttonDiv:active {\n    background: #2794f8;\n    ... \/\/ \u5176\u4ed6\u6837\u5f0f\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fElement UI \u6309\u94ae\u70b9\u51fb\u540e\u5982\u4f55\u8ba9\u80cc\u666f\u8272\u81ea\u52a8\u6d88\u5931\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>element ui \u6309\u94ae\u70b9\u51fb\u540e\u80cc\u666f\u8272\u5982\u4f55\u968f\u9f20\u6807\u79fb\u5f00\u800c\u6d88\u5931\uff1f \u5f53\u4f7f\u7528 element ui \u5e26\u6709 :focus \u7684\u6309\u94ae\u65f6\uff0c\u6309\u94ae\u5728\u88ab\u70b9\u51fb\u540e\u4f1a\u4fdd\u6301\u80cc\u666f\u8272\u3002\u8981\u8ba9\u80cc\u666f\u8272\u968f\u7740\u9f20\u6807\u79fb\u5f00\u800c\u6d88\u5931\uff0c\u53ef\u4ee5\u6709\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6848\uff1a blur \u6309\u94ae\u5143\u7d20 clickhandler(evt) { let target = evt.target; if(target.nodename == &#8220;span&#8221;){ target = evt.target.parentnode; } target.blur(); } \u767b\u5f55\u540e\u590d\u5236 \u91cd\u5199 \u6837\u5f0f \u901a\u8fc7\u91cd\u5199 css \u6837\u5f0f\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6309\u94ae\u5728\u4e0d\u540c\u72b6\u6001\u4e0b\u7684\u5916\u89c2\u3002 &lt;el-button class=&#8221;buttondiv&#8221; size=&#8221;small&#8221;&gt;\u67e5\u8be2&lt;\/el-button&gt; &lt;el-button class=&#8221;buttondiv&#8221; size=&#8221;small&#8221;&gt;\u91cd\u7f6e&lt;\/el-button&gt; \u767b\u5f55\u540e\u590d\u5236 \/*\u9f20\u6807\u70b9\u51fb\u540e\u79fb\u5f00\uff0c\u6062\u590d\u672c\u8eab\u6837\u5f0f*\/ .buttonDiv, .buttonDiv:focus:not(.buttonDiv:hover){ &#8230; \/\/ \u5176\u4ed6\u6837\u5f0f } \/*\u9f20\u6807\u60ac\u6d6e\uff0c\u6ca1\u6709\u6309\u4e0b\uff1b\u9f20\u6807\u6309\u4e0b\u540e\u62ac\u8d77\uff0c\u6ca1\u6709\u79fb\u5f00*\/ .buttonDiv:focus, .buttonDiv:hover{ background: #eaf5ff; &#8230; \/\/ \u5176\u4ed6\u6837\u5f0f } [&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-25975","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25975","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=25975"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25975\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}