【发布时间】:2021-06-06 15:09:08
【问题描述】:
我正在尝试执行Livewire Quickstart。我已正确安装所有内容并复制了示例中显示的代码,动态行为对我不起作用。也就是说,我不知道它是否加载了 Javascript,因为控制台中没有出现任何内容。
html:
@livewireStyles
</head>
<body>
<livewire:counter/>
@livewireScripts
</body>
</html>
班级:
class Counter extends Component
{
// cual propiedad puede accederse por el componente..
public $count=0;
public function increment()
{
$this->count++;
}
public function render()
{
return view('livewire.counter');
}
}
按钮:
<div class="inline-block mr-2 mt-2">
{{-- wire: evento que se espera... ='metodo al que llama' --}}
<button wire:click="increment" type="button" class="focus:outline-none text-white text-sm py-2.5 px-5 rounded-md bg-green-500 hover:bg-green-600 hover:shadow-lg">Aumentar</button>
</div>
它不适用于php artisan serve 或我创建的虚拟服务器,如果路径错误,我也会转录:
DocumentRoot "C:\xampp\htdocs\cursos\public" 服务器名称 cursos.test 选项全部 允许覆盖所有 要求所有授予
谢谢
【问题讨论】:
-
您是否看到任何控制台错误?
-
@Digvijay,不,我不知道如何在浏览器控制台中检查这样的事情。是否存在与带有 livewire 的
console.log ()的等价物?
标签: laravel-8 laravel-livewire