{"id":53443,"date":"2024-12-03T11:20:11","date_gmt":"2024-12-03T03:20:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53443\/"},"modified":"2024-12-03T11:20:11","modified_gmt":"2024-12-03T03:20:11","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e9%81%ae%e7%bd%a9%e5%8a%a8%e7%94%bb%e5%ae%9e%e7%8e%b0-vue-3-%e4%b8%ad%e7%9a%84%e5%9b%be%e5%83%8f%e8%bd%ae%e6%92%ad%e6%95%88%e6%9e%9c%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53443\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f <\/h1>\n<p>\u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f \u300b<\/span>\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241130\/1732954191674ac84f43673.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5b9e\u73b0\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\u7684Vue 3 \u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u4f60\u9047\u5230\u7684\u95ee\u9898\u662f\u6839\u636e\u63d0\u4f9b\u7684\u7f51\u7ad9\u793a\u4f8b\uff0c\u5728 Vue 3 \u4e2d\u5b9e\u73b0\u56fe\u50cf\u81ea\u52a8\u5207\u6362\u6548\u679c\u3002\u7f51\u7ad9\u4e0a\u7684\u6548\u679c\u662f\u901a\u8fc7\u4f7f\u7528\u4e24\u4e2a\u5e26\u6709\u201canimation\u201d\u7c7b\u7684\u76d2\u5b50\u6765\u5b9e\u73b0\u7684\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a\u906e\u7f69\u52a8\u753b<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u4f60\u7684\u95ee\u9898\uff0c\u4e00\u79cd\u53ef\u884c\u7684\u89e3\u51b3\u65b9\u6848\u662f\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u3002\u906e\u7f69\u52a8\u753b\u662f\u4e00\u79cd\u901a\u8fc7\u5728\u5143\u7d20\u4e0a\u6dfb\u52a0\u8def\u5f84\u6765\u521b\u5efa\u6548\u679c\u7684\u6280\u672f\uff0c\u8be5\u8def\u5f84\u4f1a\u6cbf\u7740\u8be5\u8def\u5f84\u79fb\u52a8\u3002<\/p>\n<p><strong>\u5b9e\u73b0\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\u5c06\u4e00\u4e2a\u906e\u7f69\u6dfb\u52a0\u5230\u6700\u4e0a\u5c42\u7684\u56fe\u50cf\u3002<\/li>\n<li>\u5728\u906e\u7f69\u4e0a\u8bbe\u7f6e\u8def\u5f84\u52a8\u753b\u3002<\/li>\n<li>\u5f53\u8def\u5f84\u52a8\u753b\u5b8c\u6210\u540e\uff0c\u5207\u6362\u6700\u4e0a\u5c42\u7684\u56fe\u50cf\u3002<\/li>\n<\/ol>\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>&lt;div class=\"shop-card\"&gt;\n  &lt;div class=\"mask\"&gt;\n    &lt;svg&gt;\n      &lt;path d=\"M 0 0 L 100% 0 L 100% 100% L 0 100% Z\" \/&gt;\n    &lt;\/svg&gt;\n  &lt;\/div&gt;\n  &lt;img v-for=\"img in images\" v-lazy=\"img\" :style=\"{ 'z-index': index }\" \/&gt;\n&lt;\/div&gt;<\/pre>\n<pre>.mask {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  overflow: hidden;\n}\n\n.mask path {\n  stroke: black;\n  stroke-width: 1;\n  fill: none;\n}\n\n.mask path.active {\n  animation: path 5s linear infinite;\n}\n\n@keyframes path {\n  0% {\n    stroke-dashoffset: 0;\n  }\n  100% {\n    stroke-dashoffset: 100%;\n  }\n}<\/pre>\n<pre>\/\/ Vue 3 \u7ec4\u4ef6\u7684 JavaScript \u4ee3\u7801\nexport default {\n  mounted() {\n    const path = this.$refs.path;\n    path.addEventListener('transitionend', this.onPathEnd);\n  },\n  unmounted() {\n    const path = this.$refs.path;\n    path.removeEventListener('transitionend', this.onPathEnd);\n  },\n  methods: {\n    onPathEnd() {\n      \/\/ \u5728\u8def\u5f84\u52a8\u753b\u5b8c\u6210\u540e\u5207\u6362\u56fe\u50cf\n      \/\/ ...\n    }\n  }\n}<\/pre>\n<p><strong>\u603b\u7ed3<\/strong><\/p>\n<p>\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u53ef\u4ee5\u8ba9\u4f60\u5b9e\u73b0\u4e00\u4e2a\u52a8\u6001\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff0c\u8fd9\u4e0e\u63d0\u4f9b\u7684\u7f51\u7ad9\u793a\u4f8b\u7c7b\u4f3c\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5177\u6709\u4e0d\u540c\u6570\u91cf\u56fe\u50cf\u7684\u9879\u76ee\u3002<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\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   \u91cd\u6784\u89c4\u5219\u5f15\u64ce DSL\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f \u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86\u300a\u5982\u4f55\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u5b9e\u73b0 Vue 3 \u4e2d\u7684\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\uff1f \u300b\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~ \u5b9e\u73b0\u56fe\u50cf\u8f6e\u64ad\u6548\u679c\u7684Vue 3 \u89e3\u51b3\u65b9\u6848 \u4f60\u9047\u5230\u7684\u95ee\u9898\u662f\u6839\u636e\u63d0\u4f9b\u7684\u7f51\u7ad9\u793a\u4f8b\uff0c\u5728 Vue 3 \u4e2d\u5b9e\u73b0\u56fe\u50cf\u81ea\u52a8\u5207\u6362\u6548\u679c\u3002\u7f51\u7ad9\u4e0a\u7684\u6548\u679c\u662f\u901a\u8fc7\u4f7f\u7528\u4e24\u4e2a\u5e26\u6709\u201canimation\u201d\u7c7b\u7684\u76d2\u5b50\u6765\u5b9e\u73b0\u7684\u3002 \u89e3\u51b3\u65b9\u6848\uff1a\u906e\u7f69\u52a8\u753b \u8981\u89e3\u51b3\u4f60\u7684\u95ee\u9898\uff0c\u4e00\u79cd\u53ef\u884c\u7684\u89e3\u51b3\u65b9\u6848\u662f\u4f7f\u7528\u906e\u7f69\u52a8\u753b\u3002\u906e\u7f69\u52a8\u753b\u662f\u4e00\u79cd\u901a\u8fc7\u5728\u5143\u7d20\u4e0a\u6dfb\u52a0\u8def\u5f84\u6765\u521b\u5efa\u6548\u679c\u7684\u6280\u672f\uff0c\u8be5\u8def\u5f84\u4f1a\u6cbf\u7740\u8be5\u8def\u5f84\u79fb\u52a8\u3002 \u5b9e\u73b0\u6b65\u9aa4\uff1a \u5c06\u4e00\u4e2a\u906e\u7f69\u6dfb\u52a0\u5230\u6700\u4e0a\u5c42\u7684\u56fe\u50cf\u3002 \u5728\u906e\u7f69\u4e0a\u8bbe\u7f6e\u8def\u5f84\u52a8\u753b\u3002 \u5f53\u8def\u5f84\u52a8\u753b\u5b8c\u6210\u540e\uff0c\u5207\u6362\u6700\u4e0a\u5c42\u7684\u56fe\u50cf\u3002 \u4ee3\u7801\u793a\u4f8b\uff1a &lt;div class=&#8221;shop-card&#8221;&gt; &lt;div class=&#8221;mask&#8221;&gt; &lt;svg&gt; &lt;path d=&#8221;M 0 0 L 100% 0 L 100% 100% L 0 100% Z&#8221; \/&gt; &lt;\/svg&gt; &lt;\/div&gt; &lt;img v-for=&#8221;img in images&#8221; v-lazy=&#8221;img&#8221; :style=&#8221;{ &#8216;z-index&#8217;: index }&#8221; \/&gt; [&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-53443","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53443","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=53443"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53443\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}