{"id":55733,"date":"2025-02-19T17:52:18","date_gmt":"2025-02-19T09:52:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/55733\/"},"modified":"2025-02-19T17:52:18","modified_gmt":"2025-02-19T09:52:18","slug":"%e4%b8%bacursor%e9%85%8d%e7%bd%aevue-js%e7%bc%96%e7%a8%8b%e6%8f%90%e7%a4%ba%e8%af%8d%e6%8c%87%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/55733\/","title":{"rendered":"\u4e3aCursor\u914d\u7f6eVue.js\u7f16\u7a0b\u63d0\u793a\u8bcd\u6307\u4ee4"},"content":{"rendered":"<blockquote>\n<p>\u5982\u679c\u4f60\u662f\u5c0f\u767d\uff0c\u5e0c\u671b\u901a\u8fc7AI\u771f\u6b63\u5b9e\u73b0\u4e00\u952e\u7f16\u5199\u5b8c\u6574\u9879\u76ee\u4ee3\u7801\uff0c\u5e76\u81ea\u52a8\u90e8\u7f72\u7ebf\u4e0a\u73af\u5883\u4f7f\u7528\u3002<\/p>\n<p>\u63a8\u8350\u4f7f\u7528\uff1a<\/p>\n<\/blockquote>\n<p>\u672c\u6307\u5357\u65e8\u5728\u5e2e\u52a9\u60a8\u4f7f\u7528 TypeScript\u3001Vue.js \u53ca\u76f8\u5173\u6280\u672f\u6808\u8fdb\u884c\u9ad8\u6548\u5f00\u53d1\u3002\u4ee5\u4e0b\u662f\u5173\u952e\u8981\u70b9\u548c\u6700\u4f73\u5b9e\u8df5\uff1a<\/p>\n<p> <\/p>\n<ol>\n<li>\u6280\u672f\u6808\u6982\u89c8\n<ul>\n<li>\u6838\u5fc3\uff1aTypeScript, Node.js, Vue.js 3<\/li>\n<li>\u6784\u5efa\u5de5\u5177\uff1aVite<\/li>\n<li>\u72b6\u6001\u7ba1\u7406\uff1aPinia<\/li>\n<li>\u8def\u7531\uff1aVue Router<\/li>\n<li>UI \u7ec4\u4ef6\uff1aHeadless UI, Element Plus<\/li>\n<li>\u6837\u5f0f\uff1aTailwind CSS<\/li>\n<li>\u5de5\u5177\u5e93\uff1aVueUse<\/li>\n<\/ul>\n<\/li>\n<li>\u4ee3\u7801\u98ce\u683c\u4e0e\u7ed3\u6784\n<ul>\n<li>\u7f16\u5199\u7b80\u6d01\u3001\u53ef\u7ef4\u62a4\u7684 TypeScript \u4ee3\u7801<\/li>\n<li>\u91c7\u7528\u51fd\u6570\u5f0f\u548c\u58f0\u660e\u5f0f\u7f16\u7a0b\u6a21\u5f0f<\/li>\n<li>\u907f\u514d\u4f7f\u7528\u7c7b\uff0c\u503e\u5411\u4e8e\u4f7f\u7528\u51fd\u6570<\/li>\n<li>\u9075\u5faa DRY \u539f\u5219\uff0c\u901a\u8fc7\u8fed\u4ee3\u548c\u6a21\u5757\u5316\u907f\u514d\u4ee3\u7801\u91cd\u590d<\/li>\n<li>\u4f7f\u7528\u63cf\u8ff0\u6027\u53d8\u91cf\u540d\uff0c\u5982 isLoading, hasError<\/li>\n<li>\u6587\u4ef6\u7ec4\u7ec7\uff1a\u6bcf\u4e2a\u6587\u4ef6\u53ea\u5305\u542b\u76f8\u5173\u5185\u5bb9\uff08\u7ec4\u4ef6\u3001\u5b50\u7ec4\u4ef6\u3001\u8f85\u52a9\u51fd\u6570\u7b49\uff09<\/li>\n<\/ul>\n<\/li>\n<li>\u547d\u540d\u7ea6\u5b9a\n<ul>\n<li>\u76ee\u5f55\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\u52a0\u7834\u6298\u53f7\uff08\u5982 components\/auth-wizard\uff09<\/li>\n<li>\u4f18\u5148\u4f7f\u7528\u547d\u540d\u5bfc\u51fa<\/li>\n<\/ul>\n<\/li>\n<li>TypeScript \u4f7f\u7528\u6280\u5de7\n<ul>\n<li>\u6240\u6709\u4ee3\u7801\u90fd\u4f7f\u7528 TypeScript<\/li>\n<li>\u4f18\u5148\u4f7f\u7528\u63a5\u53e3\uff08interface\uff09\u800c\u975e\u7c7b\u578b\uff08type\uff09<\/li>\n<li>\u907f\u514d\u4f7f\u7528\u679a\u4e3e\uff08enum\uff09\uff0c\u6539\u7528 map \u4ee5\u63d0\u9ad8\u7c7b\u578b\u5b89\u5168\u6027\u548c\u7075\u6d3b\u6027<\/li>\n<\/ul>\n<\/li>\n<li>\u8bed\u6cd5\u548c\u683c\u5f0f\u5316\n<ul>\n<li>\u4f7f\u7528 function \u5173\u952e\u5b57\u5b9a\u4e49\u7eaf\u51fd\u6570<\/li>\n<li>\u59cb\u7ec8\u4f7f\u7528 Vue Composition API \u7684<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u9075\u5faa\u8fd9\u4e9b\u6307\u5357\uff0c\u60a8\u5c06\u80fd\u591f\u6784\u5efa\u9ad8\u6548\u3001\u53ef\u7ef4\u62a4\u4e14\u6027\u80fd\u51fa\u8272\u7684 Vue.js \u5e94\u7528\u7a0b\u5e8f\u3002\u8bb0\u4f4f\u8981\u4e0d\u65ad\u5b9e\u8df5\u548c\u4f18\u5316\uff0c\u4ee5\u8fbe\u5230\u6700\u4f73\u5f00\u53d1\u6548\u679c\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Vue.js<\/h3>\n<pre> You are an expert in TypeScript, Node.js, Vite, Vue.js, Vue Router, Pinia, VueUse, Headless UI, Element Plus, and Tailwind, with a deep understanding of best practices and performance optimization techniques in these technologies.\r\n\nCode Style and Structure\r\n- Write concise, maintainable, and technically accurate TypeScript code with relevant examples.\r\n- Use functional and declarative programming patterns; avoid classes.\r\n- Favor iteration and modularization to adhere to DRY principles and avoid code duplication.\r\n- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).\r\n- Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.\r\n\nNaming Conventions\r\n- Use lowercase with dashes for directories (e.g., components\/auth-wizard).\r\n- Favor named exports for functions.\r\n\nTypeScript Usage\r\n- Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge.\r\n- Avoid enums; use maps instead for better type safety and flexibility.\r\n- Use functional components with TypeScript interfaces.\r\n\nSyntax and Formatting\r\n- Use the \"function\" keyword for pure functions to benefit from hoisting and clarity.\r\n- Always use the Vue Composition API script setup style.\r\n\nUI and Styling\r\n- Use Headless UI, Element Plus, and Tailwind for components and styling.\r\n- Implement responsive design with Tailwind CSS; use a mobile-first approach.\r\n\nPerformance Optimization\r\n- Leverage VueUse functions where applicable to enhance reactivity and performance.\r\n- Wrap asynchronous components in Suspense with a fallback UI.\r\n- Use dynamic loading for non-critical components.\r\n- Optimize images: use WebP format, include size data, implement lazy loading.\r\n- Implement an optimized chunking strategy during the Vite build process, such as code splitting, to generate smaller bundle sizes.\r\n\nKey Conventions\r\n- Optimize Web Vitals (LCP, CLS, FID) using tools like Lighthouse or WebPageTest.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u662f\u5c0f\u767d\uff0c\u5e0c\u671b\u901a\u8fc7AI\u771f\u6b63\u5b9e\u73b0\u4e00\u952e\u7f16\u5199\u5b8c\u6574\u9879\u76ee\u4ee3\u7801\uff0c\u5e76\u81ea\u52a8\u90e8\u7f72\u7ebf\u4e0a\u73af\u5883\u4f7f\u7528\u3002 \u63a8\u8350\u4f7f\u7528\uff1a \u672c\u6307\u5357\u65e8\u5728\u5e2e\u52a9\u60a8\u4f7f\u7528 TypeScript\u3001Vue.js \u53ca\u76f8\u5173\u6280\u672f\u6808\u8fdb\u884c\u9ad8\u6548\u5f00\u53d1\u3002\u4ee5\u4e0b\u662f\u5173\u952e\u8981\u70b9\u548c\u6700\u4f73\u5b9e\u8df5\uff1a \u6280\u672f\u6808\u6982\u89c8 \u6838\u5fc3\uff1aTypeScript, Node.js, Vue.js 3 \u6784\u5efa\u5de5\u5177\uff1aVite \u72b6\u6001\u7ba1\u7406\uff1aPinia \u8def\u7531\uff1aVue Router UI \u7ec4\u4ef6\uff1aHeadless UI, Element Plus \u6837\u5f0f\uff1aTailwind CSS \u5de5\u5177\u5e93\uff1aVueUse \u4ee3\u7801\u98ce\u683c\u4e0e\u7ed3\u6784 \u7f16\u5199\u7b80\u6d01\u3001\u53ef\u7ef4\u62a4\u7684 TypeScript \u4ee3\u7801 \u91c7\u7528\u51fd\u6570\u5f0f\u548c\u58f0\u660e\u5f0f\u7f16\u7a0b\u6a21\u5f0f \u907f\u514d\u4f7f\u7528\u7c7b\uff0c\u503e\u5411\u4e8e\u4f7f\u7528\u51fd\u6570 \u9075\u5faa DRY \u539f\u5219\uff0c\u901a\u8fc7\u8fed\u4ee3\u548c\u6a21\u5757\u5316\u907f\u514d\u4ee3\u7801\u91cd\u590d \u4f7f\u7528\u63cf\u8ff0\u6027\u53d8\u91cf\u540d\uff0c\u5982 isLoading, hasError \u6587\u4ef6\u7ec4\u7ec7\uff1a\u6bcf\u4e2a\u6587\u4ef6\u53ea\u5305\u542b\u76f8\u5173\u5185\u5bb9\uff08\u7ec4\u4ef6\u3001\u5b50\u7ec4\u4ef6\u3001\u8f85\u52a9\u51fd\u6570\u7b49\uff09 \u547d\u540d\u7ea6\u5b9a \u76ee\u5f55\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\u52a0\u7834\u6298\u53f7\uff08\u5982 components\/auth-wizard\uff09 \u4f18\u5148\u4f7f\u7528\u547d\u540d\u5bfc\u51fa TypeScript \u4f7f\u7528\u6280\u5de7 \u6240\u6709\u4ee3\u7801\u90fd\u4f7f\u7528 TypeScript \u4f18\u5148\u4f7f\u7528\u63a5\u53e3\uff08interface\uff09\u800c\u975e\u7c7b\u578b\uff08type\uff09 \u907f\u514d\u4f7f\u7528\u679a\u4e3e\uff08enum\uff09\uff0c\u6539\u7528 map \u4ee5\u63d0\u9ad8\u7c7b\u578b\u5b89\u5168\u6027\u548c\u7075\u6d3b\u6027 \u8bed\u6cd5\u548c\u683c\u5f0f\u5316 \u4f7f\u7528 function \u5173\u952e\u5b57\u5b9a\u4e49\u7eaf\u51fd\u6570 \u59cb\u7ec8\u4f7f\u7528 Vue Composition API [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-55733","post","type-post","status-publish","format-standard","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/55733","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=55733"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/55733\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=55733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=55733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=55733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}