Nuxt 3 已于 31 July 2026 结束生命周期
此版本将不再接收错误修复或安全补丁。 升级到 Nuxt 4 或获取 HeroDevs 提供的延长支持

clearNuxtState

删除 useState 的缓存状态。

Maschinelle Übersetzung ·0 % geprüft

如果你想使 useState 的状态失效,此方法非常有用。

类型

Signatur
export function clearNuxtState (keys?: string | string[] | ((key: string) => boolean)): void

参数

  • keys:用于在 useState 中删除缓存状态的一个键或键数组。如果未提供键,所有状态 都将失效。