Z
ZHANK
💚

Vue 3 速查表

Vue 3 Composition API、响应式、指令、路由、Pinia 状态管理速查

Vue 3 速查表

Composition API

模板语法

Props 与 Emits

路由 (Vue Router)

const routes = [
  { path: '/', component: Home },
  { path: '/user/:id', component: User, props: true },
];

Pinia 状态管理

// store/counter.js
import { defineStore } from 'pinia';
export const useCounterStore = defineStore('counter', () => {
  const count = ref(0);
  const double = computed(() => count.value * 2);
  function increment() { count.value++; }
  return { count, double, increment };
});