如何在 Laravel 中更新 Example.vue?
我刚刚阅读了这个问题的答案,并没有得到很好的答复.
I just read the answers to this question and wasn't able to get a good response.
Laravel Example.vue 未更新
我也发布了这个问题,试图自己解决,但无济于事.
I also posted this question trying to figure it out on my own but to no avail.
如何加载 Vue 组件在 Laravel 5.4 中?
作为另一次尝试,我刚刚重新安装了 Laravel,虽然我能够在一个视图中多次加载默认的 Example.vue 组件,但我仍然无法更改组件的内容.更有趣的是,当我运行 npm install 然后 npm run dev 时,组件甚至不再出现.
As another attempt, I just did a new reinstall of Laravel, and while I am able to get the default Example.vue component to load multiple times in a single view, I am still unable to change the contents of the component. Funnier thing is that when I run npm install and then npm run dev, the component ceases to even show up anymore.
这真的很令人沮丧,因为 Laravel 附带了 Vue.js,但我无法使用它.任何帮助将非常感激!:)
This is really frustrating because Laravel ships with Vue.js yet I am unable to utilize it. Any help would be much appreciated! :)
推荐答案
需要安装node依赖,然后编译.
You need to install the node dependencies and then compile them.
- 安装 node.js
- 从您的项目根目录运行
npm install
- 从您的项目根目录运行
npm run dev
您的浏览器也可能显示缓存版本.Chrome 有一个设置,您可以在检查器打开时禁用缓存.
Your browser may also be showing the cached version. Chrome has a setting that you can have the cache disabled while the inspector is open.
您也可以通过在其他浏览器中打开您的项目来检查它.
You can also check it by opening your project in other browsers.
如果在运行 npm run dev
时没有任何消息,你可以删除你的 node_modules 文件夹,然后运行 npm install
然后再次编译你的资产.
If when running npm run dev
dies without any message of any kind you can delete your node_modules folder then run npm install
and then compile your assets again.
您可能还需要使用命令清除和重建一些其他缓存:
You may also need to clear and rebuild a few other caches with commands:
composer dump-autoload
php artisan clear-compiled
php artisan cache:clear
https://laravel.com/docs/5.4/mix
https://laravel.com/docs/5.4/frontend
相关文章