1.0.0 • Published 5 years ago
lavuetils v1.0.0
LaVuetils
Object Oriented Vue Instance Manipulation, with Laravel in mind.
SETUP
- Let's start from a fresh Laravel project and work directly from a project that has scaffolded the Vue UI with authentication:
laravel new Project
cd Project
composer require laravel/ui --dev
php artisan ui vue --auth
npm install lavuetils
npm run watch
If you already have a project, then simply run:
npm install lavuetils
- In the app.js file, replace the default Vue Instance with the following:
FROM:
// resources/js/app.js
const app = new Vue({
el: '#app',
});
TO:
// resources/js/app.js
import lavuetils from 'lavuetils'
window.lavuetils = lavuetils
Remove "defer" from the header script tag of you app layout blade.
From:
<script src="{{ asset('js/app.js') }}" defer></script>
To:
<script src="{{ asset('js/app.js') }}"></script>
Instantiate the Vue instance with a separate script tag at the bottom of the body.
<script>
lavuetils.instantiate()
</script>
1.0.0
5 years ago