If you are using Laravel 8 PHP framework and want to install Vue.js here is how you can do it.
- Run command: npm install --save vue
- Add below to resources/js/app.js:
window.Vue = require('vue'); Vue.component('example-component', require('./components/VueComponent.vue').default); const app = new Vue({ el: '#app', });
- Create your component: VueComponent.vue
<template> <div>Testing vue with Laravel 8</div> </template> <script> export default { mounted() { console.log("Testing vue with Laravel 8"); }}; </script>
- In the head section of resources/views/layouts/app.blade.php add <script src="{{ asset('js/app.js') }}" defer></script> and add id="app" to <body>
- Add or main in your layout file (resources/views/layouts/app.blade.php)
- Add <example-component /> to your view
- Now runnpm run dev, in devtools you should see the console log.
More Posts related to PHP,- Delete file using PHP code : unlink()
- PHP header location function not called
- 403 forbidden error for Image
- Call PHP function on Button click using jquery ajax
- How to Pretty Print JSON in PHP
- Step-by-Step Guide: How to Fix - Error Establishing a Database Connection in WordPress
- PHP Base64 encoding decoding a variable
- PHP Fatal error : Call to a member function bind_param() on a non-object
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes
- PHP drag and drop file upload tutorial using dropzone.js
- Upload Pdf file using PHP Script
- PHP Warning: Cannot modify header information - headers already sent
- macOS - cannot calculate MAC address: Using fd 9 hv_vm_create HV_ERROR [PHP XAMPP]
- PHP Code for sending Emails
- How to destroy PHP session()
- Installing vue.js in Laravel 8
- PHP 301 Redirect Permanently
- Upload docx file using PHP script
- Save current timestamp in MySQL using PHP mysqi binding
- Copy file from one directory to other in Php
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP Script to Upload Images to Server
More Posts:- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020 - Android
- [Fix] java: incompatible types: java.lang.String cannot be converted to int - Java
- How to clear Cache, Cookies and History on iPhone Safari - iOS
- Fix: SpringFramework BeanDefinitionValidationException: Could not find an init method named - Java
- Split String in Python with Multiple Delimiters - Python
- How to Uninstall Microsoft Teams on Mac - Teams
- Java SE JDBC Select Statement Example - Java
- PHP Fatal error : Call to a member function bind_param() on a non-object - PHP