久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      一文詳解laravel如何安裝inertia vue3的版本

      下面由Laravel教程欄目給大家介紹laravel如何安裝inertia vue3的版本,希望對(duì)大家有所幫助!

      一、安裝前要求

      1.1 已安裝laravel框架
      1.2 已安裝Node JS
      1.3 已安裝Npm包管理工具

      二、服務(wù)端配置

      2.1 第一步:composer安裝inertia-laravel

      $ composer require inertiajs/inertia-laravel

      2.2 第二步:laravel目錄resouces/views/新增app.blade.php文件,加入以下代碼

      <!DOCTYPE html><html>     <head>         <meta charset="utf-8"/>         <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>         <link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>         <script src="{{ mix('/js/app.js') }}" defer></script>     </head>     <body>         @inertia    </body></html>

      2.3 第三步:執(zhí)行artisan命令,添加中間件

      $ php artisan inertia:middleware

      文件生成后,手動(dòng)添加到Kernel文件中的web中間件組最后一行

      'web' => [     // ...     AppHttpMiddlewareHandleInertiaRequests::class,],

      三、客戶端配置

      3.1第一步:使用npm命令安裝前端框架依賴,安裝VUE3版本。

      $ npm install @inertiajs/inertia @inertiajs/inertia-vue3

      3.2第二步:初始化應(yīng)用
      打開/resouces/js/app.js,清空后覆蓋以下代碼

      import { createApp, h } from 'vue'import { createInertiaApp } from '@inertiajs/inertia-vue3'createInertiaApp({   resolve: name => require(`./Pages/${name}`),   setup({ el, app, props, plugin }) {     createApp({ render: () => h(app, props) })       .use(plugin)       .mount(el)   },})

      3.3第三步:npm安裝進(jìn)度條包
      使用inertia做出來的頁面,瀏覽器不會(huì)刷新,為了用戶感知增加了頁面頂部進(jìn)度條這種友好的提示[腦補(bǔ)一下]

      $ npm install @inertiajs/progress

      安裝完成后,引入并初始化,打開/resouces/js/app.js,清空后覆蓋以下代碼

      import { createApp, h } from 'vue'import { createInertiaApp } from '@inertiajs/inertia-vue3'import { InertiaProgress } from '@inertiajs/progress'createInertiaApp({     resolve: name => import(`./Pages/${name}`),     setup({ el, app, props, plugin }) {         createApp({ render: () => h(app, props) })             .use(plugin)             .mount(el)     },})InertiaProgress.init()

      3.4 第四步 使用以下 webpack 配置來強(qiáng)制瀏覽器在文件更新后,加載新的資源,而不是使用緩存。
      打開webpack.mix.js,清空并覆蓋以下代碼

      const mix = require('laravel-mix');mix.js('resources/js/app.js', 'public/js')     .postCss('resources/css/app.css', 'public/css', [         //     ]);mix.webpackConfig({     output: {         chunkFilename: 'js/[name].js?id=[chunkhash]',     }});

      四、安裝VUE

      第一步 使用npm命令安裝vue最新穩(wěn)定版

      $ npm install vue@next

      第二步 添加.vue()到webpack.mix.js

      const mix = require('laravel-mix');mix.js('resources/js/app.js', 'public/js')     .vue()     .postCss('resources/css/app.css', 'public/css', [         //     ]);mix.webpackConfig({     output: {         chunkFilename: 'js/[name].js?id=[chunkhash]',     }});

      第三步通過npm命令運(yùn)行

      $ npm run watch

      如果報(bào)錯(cuò)

      一文詳解laravel如何安裝inertia vue3的版本

      解決:升級(jí)vue-loader,執(zhí)行

      $ npm i vue-loader

      如果還報(bào)錯(cuò)

      一文詳解laravel如何安裝inertia vue3的版本

      解決:resouces/js目錄下新增Pages文件夾。

      成功狀態(tài)

      一文詳解laravel如何安裝inertia vue3的版本

      推薦學(xué)習(xí):《laravel視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)