Home > Software design >  Laravel Inertia scaffolding but with vue2
Laravel Inertia scaffolding but with vue2

Time:07-10

The laravel starter kit install inertia with authorizations components in vue3. I must use vue2 because other reasons. Is there anyone who has been able to configure it using vue2

  • uninstall vue3 and install vue2
  • uninstall inertia for vue3 and install the regular(compatible with vue2)

CodePudding user response:

you need to install an older version for Jetstream, edit composer.json and change

"laravel/jetstream": "2.1.4"

And finally

npm install; npm run dev; php artisan migrate

CodePudding user response:

If you check the installation guide here incase of vue2

First

Make sure that you remove inertia-vu3 like this

npm rm @inertiajs/inertia-vue3

Second

Install the Inertia client-side adapters using NPM or Yarn.

npm install @inertiajs/inertia @inertiajs/inertia-vue
yarn add @inertiajs/inertia @inertiajs/inertia-vue

At the End

Next, update your main JavaScript file to boot your Inertia app. All we're doing here is initializing the client-side framework with the base Inertia component.

import Vue from 'vue'
import { createInertiaApp } from '@inertiajs/inertia-vue'

createInertiaApp({
  resolve: name => require(`./Pages/${name}`),
  setup({ el, App, props, plugin }) {
    Vue.use(plugin)

    new Vue({
      render: h => h(App, props),
    }).$mount(el)
  },
})
  • Related