1.0.81 • Published 5 years ago
lavutils v1.0.81
lavutils
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 lavutils
npm run watch
If you already have a project, then simply run:
npm install lavutils
- 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 lavutils from 'lavutils'
window.lavutils = lavutils
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>
lavutils.instantiate()
</script>