mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
494 B
494 B
提供主题
使用 n-config-provider
来设定它全部的后代组件主题。
<n-config-provider :theme="theme">
<n-card>
<n-space>
<n-button @click="theme = darkTheme">深色</n-button>
<n-button @click="theme = null">浅色</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)
}
}
}