mahmoud-mhamed / inertia-vue-helpers
这是我创建的包 inertia-vue-helpers
0.0.7
2024-08-20 11:46 UTC
Requires
- php: ^8.1
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-09-27 17:26:20 UTC
README
安装
您可以通过 composer 安装此包
composer require mahmoud-mhamed/inertia-vue-helpers
在使用任何命令之前
必须将 \Mahmoudmhamed\InertiaVueHelpers\Providers\PackageServiceProvider::class 添加到 config=>app=>providers 数组
在使用任何命令之前
对于 laravel < 11
必须添加到 config -> app -> providers 数组
\Mahmoudmhamed\InertiaVueHelpers\Providers\PackageServiceProvider::class
对于 laravel >= 11
必须添加到 config -> app.php
'providers' => ServiceProvider::defaultProviders()->merge([ \Mahmoudmhamed\InertiaVueHelpers\Providers\PackageServiceProvider::class, ])->toArray()
要强制发布任何文件,请将 --force 添加到命令中
发布命令以从 app => Enums 复制枚举到 resources => js => enum.js
php artisan vendor:publish --tag="clone-enums-to-js-command"
发布命令以从 php 复制语言文件夹到 resources => js => lang
php artisan vendor:publish --tag="clone-lang-to-js-command"
发布命令以从 app => classes => Abilities.php 复制能力到 resources => js => ability.js
php artisan vendor:publish --tag="copy-ability-to-js-command"
发布 Vue 能力指令
php artisan vendor:publish --tag="ability-directive"
添加到 app.js
从 "@/directive/AbilityDirective" 导入 {ability_if,ability_else}
.directive('ability', ability_if)
.directive('else-ability', ability_else)
您可以从 package.json 中运行命令,通过添加到 scripts
{
....
"scripts": {
"run-all": "php artisan lang:copy && php artisan ability:clone && php artisan enums:clone-to-js",
"copy-lang": "php artisan lang:copy",
"copy-ability": "php artisan ability:clone",
"copy-enum": "php artisan enums:clone-to-js",
"dev": "vite",
"build": "vite build"
},
...
}
要允许自动生成文件,如果使用 vite.config.js 并在 plugins 数组中添加
plugins: [
....
{
name: "enum_clone",
enforce: "post",
handleHotUpdate({ server, file }) {
if (file.includes("/app/Enums")) {
exec(
"php artisan enums:clone-to-js",
(error, stdout) =>
error === null &&
console.log(`Enum Js File Generated Successfully !`)
);
}
},
},
{
name: "lang",
enforce: "post",
handleHotUpdate({ server, file }) {
if (file.includes("/lang/")) {
exec(
`php artisan lang:copy --lang=${file.includes('/ar/')?'ar':'en'} --file=${file.split('/').pop()}`,
(error, stdout) =>
error === null &&
console.log(`Lang Generated Successfully !`)
);
}
},
},
{
name: "ability",
enforce: "post",
handleHotUpdate({ server, file }) {
if (file.includes("/Abilities.php")) {
exec(
"php artisan ability:clone",
(error, stdout) =>
error === null &&
console.log(`Ability Clone Successfully !`)
);
}
},
},
],
将 Vue 组件发布到路径 resources/js/Components
php artisan vendor:publish --tag="ElTextComponent" php artisan vendor:publish --tag="ElButtonComponent" php artisan vendor:publish --tag="ElFormComponents"
发布 make chart js 或 apex chart
npm i chart.js
npm i chartjs-plugin-datalabels
npm install --save apexcharts
npm install --save vue3-apexcharts
php artisan vendor:publish --tag="Chart"
变更日志
请参阅 CHANGELOG 了解最近更改的更多信息。
贡献
请参阅 CONTRIBUTING 了解详细信息。
安全漏洞
请审查 我们的安全策略 了解如何报告安全漏洞。
致谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。