新建 theme.ts 文件
import type { GlobalThemeOverrides } from 'naive-ui'
const themeOverrides: GlobalThemeOverrides = {
common: {
primaryColor: '#EC5E42',
primaryColorHover: '#CF523A',
primaryColorPressed: '#963C2A'
// primaryColorSuppl: '#4098FC'
}
// Button: {
// textColor: '#FF0000'
// }
}
export default themeOverrides
App.vue中引入theme.ts
n-config-provider标签中加入
:theme-overrides=“themeOverrides”
<n-config-provider :locale="zhCN" :date-locale="dateZhCN" :theme-overrides="themeOverrides">
<n-dialog-provider>
<n-message-provider>
<Content />
</n-message-provider>
</n-dialog-provider>
</n-config-provider>