Reputation: 301
How I can do reusable components in Laravel Nova with Vue? I read the documentation, but I can't find a example of that. I want to use the same vue component in one or more nova components.It's possible accomplish that following the patterns from the laravel nova? Or just doing workarounds?
Upvotes: 2
Views: 1200
Reputation: 186
Couldn't you make the Vue component in '/resources/js/components/ReusableComponent.vue' and then import it in each one of your tools? Alternatively, you could create a private/public git repository which stores your reusable components and import it into each tool.
E.g.
<template>
<h1>Hello, World!</h1>
</template>
<template>
<reusable-component />
</template>
<script>
import ResuableComponent from '../../../../../resources/js/components/ReusableComponent.vue';
export default {
components: { ReusableComponent },
};
</script>
If you want to publish these tools for composer you will have to create a NPM lib which you can include into the tool so you can distribute it with it.
Upvotes: 2