I have a question that may seem simple, but I'm curious about the best way to use vue
script on pages individually without declaring it globally. For example, I have multiple pages in Laravel Blade such as the home page, category page, and product page.
What I want to do is utilize vue
to make API calls to retrieve data from the server and display products in Blade using the v-for
directive. I prefer not to use vue templates
.
This is my first time working with vue, so could someone please guide me on how to approach this?
I've looked at various resources online, all of which explain creating a vue template
and then declaring it globally in app.js for use in Blade, but that's not what I want. I simply want to create a vue file, perform operations on it, get the data, and pass it to Blade for further mapping
or looping
.
https://medium.com/justlaravel/introduction-to-vue-js-in-laravel-e8757174e58e along with other sources have been helpful in my research.