Nuxt 3 提供了一个 app.config 配置文件,用于公开应用程序中的反应式配置,并能够在生命周期内的运行时更新它,或使用 nuxt 插件并使用 HMR(热模块替换)对其进行编辑。
export default defineAppConfig({title: 'Hello App Config',description:'This is some content coming from app.config.ts that support HMR, try to update it and see it in action.',showButton: false})
<script setup>const config = useAppConfig()</script><template><NuxtExampleLayout example="app-config"><h1>{{ config.title }}</h1><p>{{ config.description }}</p><button v-if="config.showButton">I am a button</button></NuxtExampleLayout></template>

