我想动态更改主题。我定义了 lightTheme
和 darkTheme
li
export default createVuetify({ theme: { defaultTheme: "lightTheme", themes: { lightTheme: { dark: false, colors: { primary: "#ad1c3d", "page-header-background": "#d7d7ce", "page-background": "#cdcdc1", "table-header": "#cdcdc1", background: "#c0c0b5", "header-background": "#b5b5a6", "info-text": "#666660", }, }, darkTheme: { dark: true, colors: { primary: "#52E3C2", "page-header-background": "#282831", "page-background": "#32323E", "table-header": "#2e2e2e", background: "#3F3F4A", "header-background": "#4a4a59", "info-text": "#99999F", }, }, }, }, });
我可以使用 this.$vuetify.theme
访问主题,但是我找不到如何在运行时更改主题。 Vuetify 2
中执行此操作的方法有所不同。我找不到任何 Vuetify 3
的示例。
在 Vuetify 3
中动态更改主题的正确方法是什么?
P粉7369355872023-12-06 12:57:03
文档似乎不正确。文档说要使用
this.theme.global.name.value = "themeName"
但实际上是
this.theme.global.name = "themeName"