2023-10-18 10:59:43 +00:00
|
|
|
---
|
|
|
|
title: 'updateAppConfig'
|
|
|
|
description: 'Update the App Config at runtime.'
|
|
|
|
links:
|
|
|
|
- label: Source
|
|
|
|
icon: i-simple-icons-github
|
|
|
|
to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/config.ts
|
|
|
|
size: xs
|
|
|
|
---
|
2022-08-24 16:35:02 +00:00
|
|
|
|
2023-10-18 10:59:43 +00:00
|
|
|
::callout
|
|
|
|
Updates the [`app.config`](/docs/guide/directory-structure/app-config) using deep assignment. Existing (nested) properties will be preserved.
|
|
|
|
::
|
2022-08-24 16:35:02 +00:00
|
|
|
|
2023-10-18 10:59:43 +00:00
|
|
|
## Usage
|
2022-08-24 16:35:02 +00:00
|
|
|
|
|
|
|
```js
|
2023-06-05 15:03:06 +00:00
|
|
|
const appConfig = useAppConfig() // { foo: 'bar' }
|
2022-08-24 16:35:02 +00:00
|
|
|
|
|
|
|
const newAppConfig = { foo: 'baz' }
|
|
|
|
|
|
|
|
updateAppConfig(newAppConfig)
|
|
|
|
|
|
|
|
console.log(appConfig) // { foo: 'baz' }
|
|
|
|
```
|
|
|
|
|
2023-10-18 10:59:43 +00:00
|
|
|
:read-more{to="/docs/guide/directory-structure/app-config"}
|