Ecommerce (laravel and vue)

A simple ecommerce project using laravel and vue

Laravel9 and Vue3 installation

  1. laravel new ecommerce
  2. npm install vue@next vue-loader@next
  3. npm install
  4. Create app.vue and create a vue app in app.js

      1. app.js file will look like this
      import "./bootstrap";
      
      import { createApp } from "vue";
      import app from "./layouts/app.vue";
      
      createApp(app).mount("#app");
      1. app.vue file will look like this
      <template>
          <div id="app">
              <h1>hello world</h1>
          </div>
      </template>
      1. the body section on welcome.blade.php file will look like this
      <body>
          <div id="app"></div>
      
          @vite('resources/js/app.js')
      </body>
  5. install vitejs vue plugin and add it to the vite.config.js

    npm install @vitejs/plugin-vue
    import { defineConfig } from "vite";
    import laravel from "laravel-vite-plugin";
    import vue from "@vitejs/plugin-vue";
    export default defineConfig({
        plugins: [
            vue(),
            laravel({
                input: ["resources/css/app.css", "resources/js/app.js"],
                refresh: true,
            }),
        ],
    });
  6. run npm run dev and php artisan serve to see the result