Wrapping main component #1022
-
Hello everyone! I am trying to use NaiveUI message component. As per this component's requirement, I need to wrap main App component with The NaiveUI docs describes this as:
So my question is, how can I do that? I really appreciate your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure if you need to wrap the entire app in an <template>
<n-message-provider>
<div>
<!-- Your page content -->
</div>
</n-message-provider>
</template> Perhaps you could even do that in a layout component If you want to wrap the App component, maybe you could try to initialize your app by rendering your component as a parent, something ike this: import { NMessageProvider } from 'naive-ui'
createInertiaApp({
resolve: name => require(`./Pages/${name}`),
setup({ el, App, props, plugin }) {
createApp({
render: () => h(NMessageProvider, h(App, props))
})
.use(plugin)
.mount(el)
},
}) I haven't tested any of this, but it would be the first steps I'd try 👍 |
Beta Was this translation helpful? Give feedback.
I'm not sure if you need to wrap the entire app in an
n-message-provider
, seems like you could as well just wrap it in your page components, so your page would look something like:Perhaps you could even do that in a layout component
If you want to wrap the App component, maybe you could try to initialize your app by rendering your component as a parent, something ike this: