laravel livewire的wire:loading重定向方法问题

时间:2020-08-24 21:32:51

标签: php laravel laravel-livewire

我有按钮组件,它在加载时显示微调器(wire:loading),在不加载时显示图标(wire:loading.remove)。

问题是:当按钮调用重定向方法时,此按钮不显示任何内容。就像重定向禁用组件一样。

<button wire:click="trigger" title="{{$text}}" class="btn btn-{{$color}}   float-right " >
    <div >
        <div wire:loading>
            <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
        </div>
        <div wire:loading.remove>
            @if ($icon)
                <i class="fas {{$icon}}"></i>
            @endif
        </div>
    </div>
</button>



 public function trigger(){

        if(!empty($this->event)){
            $this->emit('show-modal');
            $this->emit($this->event, $this->params);
        }

        if($this->url !== null){
            return redirect()->to($this->url);
        }


    }


Livewire version: [v1.3.3]
Laravel version: [v6.18.35]
Browser: [Chrome]

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案