在view里添加一个components文件夹,在里面添加一个组件,然后就会出错
components里添加一个alert.blade.php之后,就出错了
<div uk-alert class="alter">
{{$slot}}
</div>
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\View\Factory] is not instantiable. in /home/sparks/webapi/vendor/illuminate/container/Container.php:1089
Stack trace:
#0 /home/sparks/webapi/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable()
#1 /home/sparks/webapi/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build()
#2 /home/sparks/webapi/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()
#3 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(247): Illuminate\Container\Container->make()
#4 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(211): Illuminate\View\Compilers\ComponentTagCompiler->componentClass()
#5 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(196): Illuminate\View\Compilers\ComponentTagCompiler->componentString()
#6 [internal function]: Illuminate\View\Compilers\ComponentTagCompiler->Illuminate\View\Compilers\{closure}()
#7 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(191): preg_replace_callback()
#8 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(89): Illuminate\View\Compilers\ComponentTagCompiler->compileSelfClosingTags()
#9 /home/sparks/webapi/vendor/illuminate/view/Compilers/ComponentTagCompiler.php(76): Illuminate\View\Compilers\ComponentTagCompiler->compileTags()
#10 /home/sparks/webapi/vendor/illuminate/view/Compilers/BladeCompiler.php(407): Illuminate\View\Compilers\ComponentTagCompiler->compile()
#11 /home/sparks/webapi/vendor/illuminate/view/Compilers/BladeCompiler.php(240): Illuminate\View\Compilers\BladeCompiler->compileComponentTags()
#12 /home/sparks/webapi/vendor/illuminate/view/Compilers/BladeCompiler.php(159): Illuminate\View\Compilers\BladeCompiler->compileString()
#13 /home/sparks/webapi/vendor/illuminate/view/Engines/CompilerEngine.php(55): Illuminate\View\Compilers\BladeCompiler->compile()
#14 /home/sparks/webapi/vendor/illuminate/view/View.php(139): Illuminate\View\Engines\CompilerEngine->get()
#15 /home/sparks/webapi/vendor/illuminate/view/View.php(122): Illuminate\View\View->getContents()
#16 /home/sparks/webapi/vendor/illuminate/view/View.php(91): Illuminate\View\View->renderContents()
#17 /home/sparks/webapi/vendor/webman/blade/src/Blade.php(47): Illuminate\View\View->render()
#18 /home/sparks/webapi/vendor/workerman/webman-framework/src/support/view/Blade.php(65): Jenssegers\Blade\Blade->render()
#19 /home/sparks/webapi/support/helpers.php(192): support\view\Blade::render()
#20 /home/sparks/webapi/app/controller/IndexController.php(11): view()
#21 /home/sparks/webapi/vendor/workerman/webman-framework/src/App.php(293): app\controller\IndexController->index()
#22 /home/sparks/webapi/vendor/workerman/webman-framework/src/App.php(122): Webman\App::Webman\{closure}()
#23 /home/sparks/webapi/vendor/workerman/workerman/Connection/TcpConnection.php(638): Webman\App->onMessage()
#24 [internal function]: Workerman\Connection\TcpConnection->baseRead()
#25 /home/sparks/webapi/vendor/workerman/workerman/Events/Event.php(193): EventBase->loop()
#26 /home/sparks/webapi/vendor/workerman/workerman/Worker.php(2467): Workerman\Events\Event->loop()
#27 /home/sparks/webapi/vendor/workerman/workerman/Worker.php(1578): Workerman\Worker->run()
#28 /home/sparks/webapi/vendor/workerman/workerman/Worker.php(1420): Workerman\Worker::forkOneWorkerForLinux()
#29 /home/sparks/webapi/vendor/workerman/workerman/Worker.php(1394): Workerman\Worker::forkWorkersForLinux()
#30 /home/sparks/webapi/vendor/workerman/workerman/Worker.php(560): Workerman\Worker::forkWorkers()
#31 /home/sparks/webapi/vendor/workerman/webman-framework/src/support/App.php(124): Workerman\Worker::runAll()
#32 /home/sparks/webapi/start.php(4): support\App::run()
#33 {main}
暂时不要用 webman/blade,请使用jenssegers/blade
/home/sparks/webapi/vendor/jenssegers/blade/src/Blade.php用这个jenssegers也使用不了components
应该是 jenssegers/blade 不支持components
相关issue
https://github.com/jenssegers/blade/issues/49
https://github.com/jenssegers/blade/issues/57
webman/blade ^1.5.2 对components做了支持
卸载
composer remove jenssegers/blade
安装
composer require webman/blade ^1.5.2
牛逼!