frontend-vue
Skill3 starsChanged 9 months agoMITView on GitHub
专业的 Vue.js 开发技能,涵盖 Nuxt 3、Vue 3 Composition API、Tailwind CSS 和 Vue 生态系统。使用此技能构建 Vue 应用程序、实现 Nuxt 功能、使用 Pinia 进行状态管理,或使用 shadcn-vue 等组件库。
In this repository37 other files it gives its agents.
- api-designSkill
- database-designSkill
- design-patternSkill
- enterprise-javaSkill
- frontend-reactSkill
- frontend-svelteSkill
- frontend-vueSkill
- git-guruSkill
- go-developmentSkill
- javascript-typescriptSkill
- product-managementSkill
- python-developmentSkill
- session-summarySkill
- swift-developmentSkill
- swiftui-developmentSkill
- system-architectureSkill
- tech-documentationSkill
- testingSkill
- xcode-managementSkill
- api-designSkill
- database-designSkill
- design-patternSkill
- enterprise-javaSkill
- frontend-reactSkill
- frontend-svelteSkill
- git-guruSkill
- go-developmentSkill
- javascript-typescriptSkill
- product-managementSkill
- python-developmentSkill
- session-summarySkill
- swift-developmentSkill
- swiftui-developmentSkill
- system-architectureSkill
- tech-documentationSkill
- testingSkill
- xcode-managementSkill
The file
Files
Vue 开发技能
现代 Vue.js 开发的综合技能,专注于 Nuxt 3、Vue 3 Composition API、Tailwind CSS 和 Vue 生态系统。
技术栈
核心框架:Vue 3 + Nuxt 3
Vue 3 特性
- 组合式 API (Composition API):使用
<script setup>复用逻辑 - 响应式系统:
ref,reactive,computed,watch - Teleport:将内容渲染到组件 DOM 层次结构之外
- Fragments:支持多个根节点
- Suspense:处理异步依赖
Nuxt 3 特性
- 自动导入:自动导入 Vue API 和组件
- 基于文件的路由:
pages/目录中的文件创建路由 - 服务器引擎 (Nitro):通用部署
- 数据获取:
useFetch,useAsyncData - 服务器路由:
server/api/中的 API 端点 - SEO/Meta:
useHead,useSeoMeta
UI 框架:Tailwind CSS + shadcn-vue
Tailwind CSS
- 实用优先架构
- 通过
tailwind.config.ts配置 - 使用 PostCSS 优化
shadcn-vue (或类似库)
- shadcn/ui 的 Vue 移植版
- 基于 Radix Vue 的可访问组件
- 关键组件:Button, Input, Select, Dialog, Toast
状态管理
- Pinia:Vue 官方状态管理库
- 模块化 Store
- TypeScript 支持
- DevTools 集成
- 无 Mutation (只有 Actions)
项目架构
推荐目录结构 (Nuxt 3)
project-root/
├── app.vue # 根组件
├── nuxt.config.ts # 配置
├── components/ # 自动导入组件
│ ├── ui/ # UI 库组件
│ │ ├── button/
│ │ └── ...
│ └── Header.vue
├── pages/ # 路由
│ ├── index.vue
│ └── about.vue
├── layouts/ # 布局包装器
│ └── default.vue
├── composables/ # 自动导入逻辑
│ └── useUser.ts
├── server/ # 服务器 API
│ └── api/
│ └── hello.ts
├── stores/ # Pinia stores
│ └── counter.ts
└── assets/ # CSS, 图片
└── main.css最佳实践
使用 <script setup> 的组合式 API
- 对响应式变量使用
const。 - 按功能组织逻辑。
- 将复杂逻辑提取到组合式函数中 (
composables/)。
性能
- 异步组件:使用
defineAsyncComponent进行懒加载。 - 懒获取:对非关键数据在
useFetch中使用lazy: true选项。 - 资源优化:使用 Nuxt Image 进行图片优化。
Nuxt 特定注意事项
- 水合不匹配 (Hydration Mismatch):确保服务器渲染的 HTML 与客户端匹配。避免在初始渲染时使用随机 ID 或日期。
- 中间件:使用路由中间件进行权限守卫 (
middleware/auth.ts)。
常见代码模式
带数据获取的 Nuxt 页面
<script setup lang="ts">
const { data: user, error } = await useFetch('/api/user/1')
if (error.value) {
console.error(error.value)
}
</script>
<template>
<div v-if="user" class="p-4">
<h1 class="text-2xl font-bold">{{ user.name }}</h1>
<p>{{ user.email }}</p>
</div>
<div v-else>加载中...</div>
</template>Pinia Store
// stores/counter.ts
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})组合式函数 (Composable)
// composables/useMouse.ts
export function useMouse() {
const x = ref(0)
const y = ref(0)
function update(event) {
x.value = event.pageX
y.value = event.pageY
}
onMounted(() => window.addEventListener('mousemove', update))
onUnmounted(() => window.removeEventListener('mousemove', update))
return { x, y }
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

