AI个人学习
和实操指南

为Cursor配置Vue.js编程提示词指令

如果你是小白,希望通过AI真正实现一键编写完整项目代码,并自动部署线上环境使用。

推荐使用:Bolt:实时AI驱动的全栈开发平台,在线生成并运行完整项目代码

本指南旨在帮助您使用 TypeScript、Vue.js 及相关技术栈进行高效开发。以下是关键要点和最佳实践:


  1. 技术栈概览
    • 核心:TypeScript, Node.js, Vue.js 3
    • 构建工具:Vite
    • 状态管理:Pinia
    • 路由:Vue Router
    • UI 组件:Headless UI, Element Plus
    • 样式:Tailwind CSS
    • 工具库:VueUse
  2. 代码风格与结构
    • 编写简洁、可维护的 TypeScript 代码
    • 采用函数式和声明式编程模式
    • 避免使用类,倾向于使用函数
    • 遵循 DRY 原则,通过迭代和模块化避免代码重复
    • 使用描述性变量名,如 isLoading, hasError
    • 文件组织:每个文件只包含相关内容(组件、子组件、辅助函数等)
  3. 命名约定
    • 目录使用小写字母加破折号(如 components/auth-wizard)
    • 优先使用命名导出
  4. TypeScript 使用技巧
    • 所有代码都使用 TypeScript
    • 优先使用接口(interface)而非类型(type)
    • 避免使用枚举(enum),改用 map 以提高类型安全性和灵活性
  5. 语法和格式化
    • 使用 function 关键字定义纯函数
    • 始终使用 Vue Composition API 的

通过遵循这些指南,您将能够构建高效、可维护且性能出色的 Vue.js 应用程序。记住要不断实践和优化,以达到最佳开发效果。

 

 

Vue.js

 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.

Code Style and Structure
- Write concise, maintainable, and technically accurate TypeScript code with relevant examples.
- Use functional and declarative programming patterns; avoid classes.
- Favor iteration and modularization to adhere to DRY principles and avoid code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.

Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for functions.

TypeScript Usage
- Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge.
- Avoid enums; use maps instead for better type safety and flexibility.
- Use functional components with TypeScript interfaces.

Syntax and Formatting
- Use the "function" keyword for pure functions to benefit from hoisting and clarity.
- Always use the Vue Composition API script setup style.

UI and Styling
- Use Headless UI, Element Plus, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.

Performance Optimization
- Leverage VueUse functions where applicable to enhance reactivity and performance.
- Wrap asynchronous components in Suspense with a fallback UI.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.
- Implement an optimized chunking strategy during the Vite build process, such as code splitting, to generate smaller bundle sizes.

Key Conventions
- Optimize Web Vitals (LCP, CLS, FID) using tools like Lighthouse or WebPageTest.
未经允许不得转载:首席AI分享圈 » 为Cursor配置Vue.js编程提示词指令

首席AI分享圈

首席AI分享圈专注于人工智能学习,提供全面的AI学习内容、AI工具和实操指导。我们的目标是通过高质量的内容和实践经验分享,帮助用户掌握AI技术,一起挖掘AI的无限潜能。无论您是AI初学者还是资深专家,这里都是您获取知识、提升技能、实现创新的理想之地。

联系我们
zh_CN简体中文