aleahy/artisan-vue-make

一个用于创建 Vue 组件并在 app.js 中注册的 artisan 命令

0.1 2021-10-02 05:52 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:23 UTC


README

创建 Vue 组件的 artisan 命令

安装

composer require --dev aleahy/artisan-vue-make

用法

创建组件

php artisan make:vue NewComponent

这将在 resources/js/components/NewComponent.vue 创建一个新的组件文件。

您可以通过使用点符号创建组件的子文件夹。

php artisan make:vue path.to.NewComponent

这将创建一个新组件文件在 `resources/js/components/path/to/NewComponent.vue`

在 app.js 中注册组件

您也可以通过为组件分配一个标签,在 app.js 文件中注册该组件。

php artisan make:vue NewComponent --tag=new-component

通过添加 --tag 选项,以下内容将被添加到 app.js 中,在之前的任何组件注册之后。

Vue.component('new-component', require('./components/NewComponent').default);