小编San*_*rez的帖子

当我在 Laravel livewire 上执行点击事件时,出现 404 模式

我已经开始使用 livewire,但我无法让它工作,我使用 awire:click在创建模式或编辑模式下加载表单,但是当我单击时,我得到的只是某种带有 404 错误的模式

这是 Livewire 组件


namespace App\Http\Livewire;

use Livewire\Component;

class Activities extends Component
{
    public $view = 'none';

    public function render()
    {
        return view('livewire.activities');
    }

    public function create_view(){

        $this->view = 'create';

    }

    public function edit(){

        $this->view = 'edit';

    }
}
Run Code Online (Sandbox Code Playgroud)

这就是观点


<button wire:click="create_view" class="button-warning">{{ __('Create') }}</button>

@if ($view != 'none')
    <div class="col-span-6">
        @include("livewire.$view")
    </div>
@endif

Run Code Online (Sandbox Code Playgroud)

编辑:我手动加载视图并且它加载正确,例如:


@if ($view != 'none')
    <div class="col-span-6">
        @include("livewire.edit")
    </div>
@endif

Run Code Online (Sandbox Code Playgroud)

laravel laravel-livewire

6
推荐指数
1
解决办法
2320
查看次数

使用 Tailwind CSS 设置侧边栏粘性或固定

我有一个工作很好的侧边栏,但是当我尝试将其放在粘性/固定位置时,类fixed使侧边栏右侧的内容覆盖侧边栏,我尝试使用sticky类但不起作用

这是侧边栏代码

<div class="md:flex flex-col md:flex-row md:min-h-screen">
    <div @click.away="open = false" class="flex flex-col md:w-64 text-gray-700 bg-white dark-mode:text-gray-200 dark-mode:bg-gray-800 flex-shrink-0 border-t border-gray-200" x-data="{ open: false }">
        <div class="flex-shrink-0 px-8 py-4 flex flex-row items-center justify-between">
            <a href="#" class="text-lg font-semibold tracking-widest text-gray-900 uppercase rounded-lg dark-mode:text-white focus:outline-none focus:shadow-outline">Arl</a>
            <button class="rounded-lg md:hidden rounded-lg focus:outline-none focus:shadow-outline" @click="open = !open">
                <svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6">
                    <path x-show="!open" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 …
Run Code Online (Sandbox Code Playgroud)

css tailwind-css

3
推荐指数
2
解决办法
3万
查看次数

标签 统计

css ×1

laravel ×1

laravel-livewire ×1

tailwind-css ×1