[naive/use-message]: No outer <n-message-provider /> founded
See original GitHub issue新手请教<n-message-provider/>到底该怎么用
# App.vue
<template>
<n-message-provider>
<HelloWorld/>
</n-message-provider>
</template>
<script setup>
import HelloWorld from './components/HelloWorld.vue';
</script>
<style>
</style>
# HelloWorld.vue
<template>
<n-space>
<n-button @click="info"> 信息 </n-button>
<n-button @click="error"> 错误 </n-button>
<n-button @click="warning"> 警告 </n-button>
<n-button @click="success"> 成功 </n-button>
<n-button @click="loading"> 加载中 </n-button>
</n-space>
</template>
<script>
import { useMessage, NButton } from 'naive-ui'
export default {
setup () {
const message = useMessage()
return {
info () {
message.info("I don't know why nobody told you how to unfold your love")
},
error () {
message.error('Once upon a time you dressed so fine')
},
warning () {
message.warning('How many roads must a man walk down')
},
success () {
message.success(
"'Cause you walked hand in hand With another man in my place"
)
},
loading () {
message.loading(
'If I were you, I will realize that I love you more than any other guy'
)
}
}
}
}
</script>
F12 报错[naive/use-message]: No outer <n-message-provider /> founded,新手实在不知道<n-message-provider />该放哪,求指教
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
vue.js - How to use useMessage and useNotification in App ...
The provider must be on the upper layer of use . You can refer to: https://github.com/Talljack/naive-ui-provider.
Read more >官网示例怎么跑通? · Issue #225 · tusen-ai/naive-ui - GitHub
Uncaught (in promise) Error: [naive/use-message]: No outer founded. Expected results (期望的结果). 期望与文档demo一直. Actual results (实际的结果). 实际情况是:
Read more >navie-ui基础| 不器小窝
Uncaught (in promise) Error: [naive/use-message]: No outer <n-message-provider /> founded. See prerequisite in https://www.naiveui.com/en-US/os- ...
Read more >Naive-UI provider management - xzcspace
You can encapsulate a component to manage all NaiveUI providers in the project, which will make the code clear and easy to understand....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
靠,这效率太低了。非要这样搞,基本上写啥啊。我不想尝试了。
https://www.naiveui.com/en-US/os-theme/components/message#Use-Message-Outside-Setup