mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
496 B
496 B
Provide Theme
Use n-config-provider
to set the theme of all its descedant components.
<n-config-provider :theme="theme">
<n-card>
<n-space>
<n-button @click="theme = darkTheme">Dark</n-button>
<n-button @click="theme = null">Light</n-button>
</n-space>
</n-card>
</n-config-provider>
import { ref } from 'vue'
import { darkTheme } from 'naive-ui'
export default {
setup () {
return {
darkTheme,
theme: ref(null)
}
}
}