Laravel-Livewire笔记系列(一)-Livewire安装

作者: 温新

分类: 【Laravel】

阅读: 2971

时间: 2021-10-14 11:12:56

作者:温新

时间:2021-08-13

hi,我是温新,一名PHPer

1)本系列笔记使用Laravel8.x作为演示;

2)使用Livewire2.x版本

什么是Livewire

官方解释:Livewire是Laravel的全栈框架,可简化构建动态接口的过程,而不会给Laravel带来麻烦。

安装Livewire

第一步:准备一个全新的框架并做好相关的数据库工作

第二步:安装laravel/ui并使用bootstrap作为驱动

composer require laravel/ui

php artisan ui bootstrap --auth
npm install
npm run dev

第三步:安装Livewire

composer require livewire/livewire

第四步:页面中使用Livewire

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    @livewireStyles
</head>
<body>
	@livewireScripts
</body>
</html>

省略了中间的内容

第五步:生成配置文件

php artisan livewire:publish --config

该命令会在config目录下生成livewire.php配置文件

第六步:查看liveware artisan 命令

php artisan
    
 livewire
  livewire:configure-s3-upload-cleanup  Configure temporary file upload s3 directory to automatically cleanup files older than 24hrs.
  livewire:copy                         Copy a Livewire component
  livewire:delete                       Delete a Livewire component
  livewire:discover                     Regenerate Livewire component auto-discovery manifest
  livewire:make                         Create a new Livewire component
  livewire:move                         Move a Livewire component
  livewire:publish                      Publish Livewire configuration
  livewire:stubs                        Publish Livewire stubs

我是温新

每天进步一点点,就一点点

请登录后再评论