前提
Vue + Laravel で SPAのWebシステムを構築しています。
ハンディターミナル(QRコードリーダー)からブラウザを使用し
同一ネットワーク上のサーバーにアクセスしています。
フロントサイドはvue.js、DBとの通信にLaravelを使用しています。
Vue.jsでハンディを提供されている会社様のjava scriptファイルを
読み込みブラウザからハンディの制御を行うつもりです。
ただ、提供されたjsファイルが Export の形ではなく functionべた書きな為
Vue.jsでImportすることができません。
実現したいこと
functionべた書きのjsファイルをVue.jsでImportする方法を探しています。
発生している問題・エラーメッセージ
エラーメッセージなし
該当のソースコード
外部jsについては公開が禁止されているため例示
・外部js
Javascript
1var HOGE = HOGE || { 2 Scan: {}, File: {}, FTP: {} 3}; 4 //略 5HOGE.FTP = (function () { 6 //略 7 return { 8 Settings: Settings 9 } 10}()); 11
・index.php(npmで自動生成されたもの)
php
1<?php 2 3use Illuminate\Contracts\Http\Kernel; 4use Illuminate\Http\Request; 5 6define('LARAVEL_START', microtime(true)); 7 8/* 9|-------------------------------------------------------------------------- 10| Check If The Application Is Under Maintenance 11|-------------------------------------------------------------------------- 12| 13| If the application is in maintenance / demo mode via the "down" command 14| we will load this file so that any pre-rendered content can be shown 15| instead of starting the framework, which could cause an exception. 16| 17*/ 18 19if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { 20 require $maintenance; 21} 22 23/* 24|-------------------------------------------------------------------------- 25| Register The Auto Loader 26|-------------------------------------------------------------------------- 27| 28| Composer provides a convenient, automatically generated class loader for 29| this application. We just need to utilize it! We'll simply require it 30| into the script here so we don't need to manually load our classes. 31| 32*/ 33 34require __DIR__.'/../vendor/autoload.php'; 35 36/* 37|-------------------------------------------------------------------------- 38| Run The Application 39|-------------------------------------------------------------------------- 40| 41| Once we have the application, we can handle the incoming request using 42| the application's HTTP kernel. Then, we will send the response back 43| to this client's browser, allowing them to enjoy our application. 44| 45*/ 46 47$app = require_once __DIR__.'/../bootstrap/app.php'; 48 49$kernel = $app->make(Kernel::class); 50 51$response = $kernel->handle( 52 $request = Request::capture() 53)->send(); 54 55$kernel->terminate($request, $response);
試したこと
・Vue.js(vue-cli)にて外部jsライブラリを読み込みたかった…(雑記)
⇒ laravel環境なのでindex.htmlではなくindex.phpになっているため不可能。
お手数をおかけしますが、何か情報ありましたらお願いいたします。
補足情報(FW/ツールのバージョンなど)
@vue/cli 5.0.4
Laravel Framework 9.17.0
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2022/11/24 05:46
2022/11/24 06:30