vuetify-skilld
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesevuetifyjs/vuetify vuetify
vuetifyvuetifyjs/vuetify vuetify
vuetifyVersion: 4.0.0-beta.2 (Feb 2026)
Tags: v1-stable: 1.5.24 (Mar 2020), v2-stable: 2.7.2 (Feb 2024), dev: 3.11.0 (Nov 2025), latest: 3.11.8 (Jan 2026), next: 4.0.0-beta.2 (Feb 2026)
References: Docs — API reference, guides • GitHub Issues — bugs, workarounds, edge cases • GitHub Discussions — Q&A, patterns, recipes • Releases — changelog, breaking changes, new APIs
版本: 4.0.0-beta.2(2026年2月)
标签: v1-stable: 1.5.24(2020年3月), v2-stable: 2.7.2(2024年2月), dev: 3.11.0(2025年11月), latest: 3.11.8(2026年1月), next: 4.0.0-beta.2(2026年2月)
参考链接: 文档 — API参考、指南 • GitHub Issues — 问题、解决方案、边缘案例 • GitHub 讨论 — 问答、模式、实践方案 • 版本发布 — 更新日志、重大变更、新API
API Changes
API 变更
This section documents version-specific API changes — prioritize recent major/minor releases.
-
BREAKING:/
VRowGrid — complete overhaul using CSSVColinstead of negative margins.gapprop removed (usedense),density="compact"/alignonjustifyandVRow/orderonalign-selfremoved in favor of utility classes sourceVCol -
BREAKING: MD3 Typography — variant names renamed for Material Design 3 compliance:-
h1->h3,display-*-h4->h6,headline-*/subtitle-1->body-1,body-large/button->subtitle-2sourcelabel-large -
BREAKING: MD3 Elevation — elevation levels reduced from 25 (0-24) to 6 (0-5) to align with MD3 density-independent pixel levels source
-
BREAKING:Defaults —
VBtnremoved by default.text-transform: uppercaseSass variable replaced by$button-stacked-icon-marginsource$button-stacked-gap -
BREAKING:/
VSelect/VAutocomplete—VComboboxslot prop renamed toitem. TheinternalItemprop is now an alias foritemsourceinternalItem.raw -
BREAKING:Slot —
VForm,isValid, anderrorsslot variables are now unwrapped values instead ofisDisabledobjects sourceRef -
NEW:— rewritten in v4 to support showing multiple snackbars simultaneously;
VSnackbarQueueslot renamed todefaultsourceitem -
NEW:
VRowprop — provides fine-grained control over grid spacing, accepting numbers, strings, orgaparrays source[x, y] -
NEW:(experimental) — new labs component for grouping multiple avatars with overlapping support source
VAvatarGroup -
NEW:(experimental) — new labs component providing a search and action interface for application commands source
VCommandPalette
Also changed: promoted from labs · promoted from labs · prop new · prop new · prop new · props new · new entry point · default theme · removed · behavior changed
VCalendarVHotkeyVToolbarlocationVAvatarbadgeVProgressCircularrevealVTreeviewindent-linesvuetify/styles/coresystemVSnackbarmulti-lineVContainerfill-height本节记录特定版本的API变更 — 优先关注近期的大版本/小版本更新。
-
重大变更:/
VRow网格系统 — 完全重构,使用CSSVCol替代负边距。移除gap属性(改用dense),移除density="compact"上的VRow/align属性以及justify上的VCol/order属性,改用工具类 来源align-self -
重大变更:MD3 排版 — 为了符合Material Design 3规范,变体名称已重命名:-
h1->h3,display-*-h4->h6,headline-*/subtitle-1->body-1,body-large/button->subtitle-2来源label-large -
重大变更:MD3 阴影层级 — 阴影层级从25级(0-24)减少到6级(0-5),以匹配MD3的密度无关像素层级 来源
-
重大变更:默认值 — 默认移除
VBtn。Sass变量text-transform: uppercase替换为$button-stacked-icon-margin来源$button-stacked-gap -
重大变更:/
VSelect/VAutocomplete—VCombobox插槽属性重命名为item。现在internalItem属性是item的别名 来源internalItem.raw -
重大变更:插槽 —
VForm、isValid和errors插槽变量现在是解包后的值,而非isDisabled对象 来源Ref -
新增:— 在v4版本中重写,支持同时显示多个通知栏;
VSnackbarQueue插槽重命名为default来源item -
新增:
VRow属性 — 提供对网格间距的精细控制,支持数字、字符串或gap数组 来源[x, y] -
新增:(实验性) — 新的实验室组件,用于将多个头像分组并支持重叠显示 来源
VAvatarGroup -
新增:(实验性) — 新的实验室组件,为应用命令提供搜索和操作界面 来源
VCommandPalette
其他变更: 从实验室组件转正 · 从实验室组件转正 · 新增属性 · 新增属性 · 新增属性 · 新增属性 · 新增入口 · 默认主题改为 · 移除的 · 的行为变更
VCalendarVHotkeyVToolbarlocationVAvatarbadgeVProgressCircularrevealVTreeviewindent-linesvuetify/styles/coresystemVSnackbarmulti-lineVContainerfill-heightBest Practices
最佳实践
- Use the modifier in the
cmdcomposable for cross-platform compatibility — automatically resolves to Command on Mac and Control on PC sourceuseHotkey
ts
// Preferred: works on both Mac and PC
useHotkey('cmd+s', (e) => saveDocument(e))
// Avoid: hardcoding 'ctrl' may cause conflicts or feel non-idiomatic on Mac
useHotkey('ctrl+s', (e) => saveDocument(e))- Apply and
classto specific component keys in thestyleconfiguration — these are not supported in thedefaultsdefaults key sourceglobal
ts
// Preferred
createVuetify({
defaults: {
VBtn: {
class: 'text-none',
style: { textTransform: 'none' }
}
}
})
// Avoid: class and style are ignored in global
createVuetify({
defaults: {
global: { class: 'text-none' }
}
})- Resolve style conflicts between Vuetify and TailwindCSS by redefining CSS layer order — place Vuetify's styles in a dedicated layer with lower precedence than Tailwind's base layer source
css
/* main.css */
@layer theme, base, vuetify, components, utilities;
@import 'vuetify/styles' layer(vuetify);
@import 'tailwindcss';-
Usewith
v-text-fieldfor high-precision decimal arithmetic —decimal.jsusesVNumberInputinternally and may suffer from standard JavaScript floating-point inaccuracies sourcetoFixed() -
Centralize snackbar messages using global state (e.g., Pinia) with— allows triggering notifications from any part of the application by pushing to a shared array source
v-snackbar-queue
vue
<template>
<v-app>
<v-snackbar-queue v-model="messages.queue" />
</v-app>
</template>- Use the prop to explicitly control layout component priority — overrides the default behavior where priority is determined solely by markup order source
order
vue
<v-navigation-drawer />
<v-app-bar :order="-1" />-
Utilize's
useDate()andparseISOmethods for standardizing date strings —toISOand other date components internally expect and return native JSVDateInputobjects sourceDate -
Use(experimental) for keyboard-driven power-user workflows — provides a pre-configured, accessible, and searchable dialog interface that implements ARIA best practices automatically source
v-command-palette -
Restore previous negative-margin/padding grid behavior during Vuetify 4 migration using theblock — necessary when existing layouts rely on the legacy system instead of the new CSS
@layer vuetify-overridesproperty sourcegap
scss
@layer vuetify-overrides {
.v-row {
gap: unset;
margin: calc(var(--v-col-gap-y) * -.5) calc(var(--v-col-gap-x) * -.5);
}
}- 在组合式函数中使用
useHotkey修饰符以实现跨平台兼容性 — 会自动在Mac上解析为Command键,在PC上解析为Control键 来源cmd
ts
// 推荐:在Mac和PC上均可正常工作
useHotkey('cmd+s', (e) => saveDocument(e))
// 避免:硬编码'ctrl'可能在Mac上引发冲突或不符合使用习惯
useHotkey('ctrl+s', (e) => saveDocument(e))- 在配置中,将
defaults和class应用于特定组件的键 — 这些在style默认键中不受支持 来源global
ts
// 推荐
createVuetify({
defaults: {
VBtn: {
class: 'text-none',
style: { textTransform: 'none' }
}
}
})
// 避免:global中的class和style会被忽略
createVuetify({
defaults: {
global: { class: 'text-none' }
}
})- 通过重新定义CSS层顺序解决Vuetify与TailwindCSS之间的样式冲突 — 将Vuetify的样式放在专用层中,优先级低于Tailwind的基础层 来源
css
/* main.css */
@layer theme, base, vuetify, components, utilities;
@import 'vuetify/styles' layer(vuetify);
@import 'tailwindcss';-
结合与
v-text-field进行高精度小数运算 —decimal.js内部使用VNumberInput,可能会受到JavaScript标准浮点数精度问题的影响 来源toFixed() -
使用全局状态(如Pinia)结合集中管理通知消息 — 允许通过向共享数组推送消息,从应用的任何部分触发通知 来源
v-snackbar-queue
vue
<template>
<v-app>
<v-snackbar-queue v-model="messages.queue" />
</v-app>
</template>- 使用属性显式控制布局组件的优先级 — 覆盖默认仅由标记顺序决定优先级的行为 来源
order
vue
<v-navigation-drawer />
<v-app-bar :order="-1" />-
利用的
useDate()和parseISO方法标准化日期字符串 —toISO和其他日期组件内部期望并返回原生JSVDateInput对象 来源Date -
使用(实验性)实现键盘驱动的高级用户工作流 — 提供预配置、可访问且支持搜索的对话框界面,自动遵循ARIA最佳实践 来源
v-command-palette -
在Vuetify 4迁移期间,使用块恢复之前的负边距/内边距网格行为 — 当现有布局依赖旧系统而非新的CSS
@layer vuetify-overrides属性时,这一步是必要的 来源gap
scss
@layer vuetify-overrides {
.v-row {
gap: unset;
margin: calc(var(--v-col-gap-y) * -.5) calc(var(--v-col-gap-x) * -.5);
}
}