question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
mrerhuocommented, Jun 21, 2021

靠,这效率太低了。非要这样搞,基本上写啥啊。我不想尝试了。

2reactions
07akionicommented, Apr 17, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found