简体   繁体   中英

Laravel Inertia scaffolding but with vue2

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)

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

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)
  },
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM