vue by antfu/skills
npx skills add https://github.com/antfu/skills --skill vue基于 Vue 3.5。始终使用 Composition API 配合
<script setup lang="ts">。
<script setup lang="ts"> 而非 <script>shallowRef 而非 ref| 主题 | 描述 | 参考链接 |
|---|---|---|
| Script Setup 与宏 | <script setup>, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, generics |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| script-setup-macros |
| 响应性与生命周期 | ref, shallowRef, computed, watch, watchEffect, effectScope, 生命周期钩子, composables | core-new-apis |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 内置组件与指令 | Transition, Teleport, Suspense, KeepAlive, v-memo, 自定义指令 | advanced-patterns |
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'
const props = defineProps<{
title: string
count?: number
}>()
const emit = defineEmits<{
update: [value: string]
}>()
const model = defineModel<string>()
const doubled = computed(() => (props.count ?? 0) * 2)
watch(() => props.title, (newVal) => {
console.log('Title changed:', newVal)
})
onMounted(() => {
console.log('Component mounted')
})
</script>
<template>
<div>{{ title }} - {{ doubled }}</div>
</template>
// Reactivity
import { ref, shallowRef, computed, reactive, readonly, toRef, toRefs, toValue } from 'vue'
// Watchers
import { watch, watchEffect, watchPostEffect, onWatcherCleanup } from 'vue'
// Lifecycle
import { onMounted, onUpdated, onUnmounted, onBeforeMount, onBeforeUpdate, onBeforeUnmount } from 'vue'
// Utilities
import { nextTick, defineComponent, defineAsyncComponent } from 'vue'
每周安装量
7.9K
代码仓库
GitHub 星标数
4.0K
首次出现
Jan 28, 2026
安全审计
安装于
opencode6.1K
codex5.9K
gemini-cli5.8K
github-copilot5.6K
cursor5.1K
kimi-cli4.9K
Based on Vue 3.5. Always use Composition API with
<script setup lang="ts">.
<script setup lang="ts"> over <script>shallowRef over ref if deep reactivity is not needed| Topic | Description | Reference |
|---|---|---|
| Script Setup & Macros | <script setup>, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, generics | script-setup-macros |
| Reactivity & Lifecycle | ref, shallowRef, computed, watch, watchEffect, effectScope, lifecycle hooks, composables | core-new-apis |
| Topic | Description | Reference |
|---|---|---|
| Built-in Components & Directives | Transition, Teleport, Suspense, KeepAlive, v-memo, custom directives | advanced-patterns |
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'
const props = defineProps<{
title: string
count?: number
}>()
const emit = defineEmits<{
update: [value: string]
}>()
const model = defineModel<string>()
const doubled = computed(() => (props.count ?? 0) * 2)
watch(() => props.title, (newVal) => {
console.log('Title changed:', newVal)
})
onMounted(() => {
console.log('Component mounted')
})
</script>
<template>
<div>{{ title }} - {{ doubled }}</div>
</template>
// Reactivity
import { ref, shallowRef, computed, reactive, readonly, toRef, toRefs, toValue } from 'vue'
// Watchers
import { watch, watchEffect, watchPostEffect, onWatcherCleanup } from 'vue'
// Lifecycle
import { onMounted, onUpdated, onUnmounted, onBeforeMount, onBeforeUpdate, onBeforeUnmount } from 'vue'
// Utilities
import { nextTick, defineComponent, defineAsyncComponent } from 'vue'
Weekly Installs
7.9K
Repository
GitHub Stars
4.0K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode6.1K
codex5.9K
gemini-cli5.8K
github-copilot5.6K
cursor5.1K
kimi-cli4.9K
97,600 周安装