1
votes

I have a custom Vue-Component located in Laravel default path for it:

  • resources/js/components/MyComponent.vue

So, I installed Laravel-Nova and want to use the component inside a view partial

  • resources/views/vendor/nova/partials/user.blade.php
<dropdown-menu slot="menu" width="200" direction="rtl">

    <my-component></my-component>

    <ul class="list-reset">
        <li>
        ...

Where should I import the Component? In other words, where should I place the:

import MyComponent from '/path/to/my/component/MyComponent.vue'

//and

Vue.component('my-component', MyComponent)

I want to do it some way I can use inside the code of the Vue Component the Nova JavaScript Helpers, like:

this.$toasted.show('It worked!', { type: 'success' })

//or

axios.get('/nova-vendor/stripe-inspector/endpoint').then(response => {
    // ...
})
1

1 Answers

0
votes

This is an example of a similar component:

import MyLens from './components/views/Lens';

Nova.booting((Vue, router, store) => {
    router.addRoutes([{
            name: 'nova-improvements',
            path: '/nova-improvements',
            component: require('./components/Tool'),
        }])
});
Nova.booting((Vue, router, store) => {
    Vue.component('lens', MyLens)
});