简体   繁体   English

如何在 Laravel 中删除 app.js 但保留 vue.js?

[英]How to remove app.js in Laravel but keep vue.js?

I want to remove "public/app.js" from my Laravel project, but when I do that my vue.js instance doesn't work.我想从我的Laravel项目中删除"public/app.js" ,但是当我这样做时,我的vue.js实例不起作用。 Is there any way to remove app.js but keep calling vue.js ?有没有办法删除app.js但继续调用vue.js

If you're only wanting to include vue in your application you can either remove the code you don't want from app.js or pull in a standalone version of vue .如果您只想在应用程序中包含vue ,您可以从app.js中删除您不想要的代码,或者引入vue的独立版本。

To just have vue in your app.js remove the require('./bootstrap');要在你的app.js中只包含 vue,请删除require('./bootstrap'); line from your resources/js/app.js file and then run npm run dev (or npm run production ).从您的resources/js/app.js文件中提取一行,然后运行npm run dev (或npm run production )。


Otherwise, you can remove app.js entirely and use one of the methods outlined on Vue's installation page eg:否则,您可以完全删除app.js并使用Vue 安装页面上列出的方法之一,例如:

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script> 

You may need to change the version number.您可能需要更改版本号。


声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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