php - Livewire 404:获取 http://localhost/livewire/livewire.js net::ERR_ABORTED 404(未找到)

标签 php html laravel laravel-livewire

我正在学习如何使用 livewire 和 laravel,我试图通过输入绑定(bind)一些数据
我写了这段代码:
home.blade.php:

<html>
<head>
    <title>Home</title>

    @livewireStyles
</head>
<body>
    @livewire("hello-world")

    @livewireScripts
</body>
</html>
你好-world.blade.php:
<div>
    <input wire:model="nome" type="text">
    <br>
    Hello {{ $nome }}
</div>
Hello World .php:
<?php

namespace App\Http\Livewire;

use Livewire\Component;

class HelloWorld extends Component
{
    public $nome = 'Name';
    public function render()
    {
        return view('livewire.hello-world');
    }
}

它在 Apache 2.4 上运行
但是如果我在加载页面时打开浏览器控制台,我会得到:

(index):29 GET http://localhost/livewire/livewire.js?id=c1db26b321e994f87254 net::ERR_ABORTED 404 (Not Found)


(index):35 Uncaught ReferenceError: Livewire is not defined at (index):35


我正在关注官方文档和截屏视频,我试图一步一步地按照所有说明进行操作,但它也不起作用。
也许我在安装过程中做错了什么,但我不这么认为,因为我刚刚打了:

composer require livewire/livewire


所以应该没问题。
有什么线索吗?
GitHub 存储库:learningLaravel

最佳答案

你可以试试这个:
运行:php artisan livewire:publish然后打开配置/livewire.php
'asset_url' => null'asset_url' => 'http://localhost'

关于php - Livewire 404:获取 http://localhost/livewire/livewire.js net::ERR_ABORTED 404(未找到),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63842545/

相关文章:

javascript - 复选框单击 v-for 循环内的无效数据

html - CSS 溢出-x : visible; and overflow-y: hidden; causing scrollbar issue

php - Laravel 5.4 中表之间的多重关系

php - 在 Laravel 中从数据库创建实体类

php - 如何通过 IP 地址检测用户的语言

php - 使用 PHPUnit 的测试数据库/数据进行功能测试

php - Unix 时间戳与日期时间

php - PayPal自适应支付IPN函数调用

javascript - onclick默认为ontouch吗

mysql - 数据库更新后如何清除缓存?