Component Generator
The Component Generator Command, will create a new Vue Component for the provided Module with a very basic boilerplate code. If you want to create a new CustomerReport
component for the Customer
Module, you can run the following command:
bash
php artisan modular:make-component Customer CustomerReport
And a new CustomerReport.vue
file will be created at resources/js/Modules/Customer/Components
folder.
bash
./resources/js/Pages/Customer
├── Components
│ └── CustomerReport.vue
├── CustomerForm.vue
└── CustomerIndex.vue
This way, you can easily import local components required by the main Pages (for example, Page ./resources/js/Pages/Customer/CustomerIndex.vue
), keeping these main Pages cleaner and organized.
vue
<!-- ./resources/js/Pages/Customer/CustomerIndex.vue -->
<template>
...
<CustomerReport />
</template>
<script setup>
import CustomerReport from "./Components/CustomerReport.vue";
...
</script>