每次我执行相同的操作请求时,运行时间都会不断增加。有什么办法可以解决吗?
在我的刀片中:
<div class="col-md-6">
<div class="form-group @error('promotion') has-error @enderror required">
<label>Promotion</label>
<select class="full-width" wire:model="promotion" wire:change="select_promotion">
<option></option>
@foreach($data_promotion as $data)
<option value="{{$data->promotion_id}}" {{$promotion==$data->promotion_id?'selected':''}}>{{$data->promotion_name}}</option>
@endforeach
</select>
<x-jet-hold wire:loading.class="visible"></x-jet-hold>
<x-jet-loading wire:loading.class="visible" wire:target="select_group"></x-jet-loading>
</div>
@error('promotion')
<label id="promotion-error" class="error" for="promotion">{{ $message }}</label>
@enderror
</div>
我的方法:
public function select_promotion()
{
$this->type_proposal_tap = 'normal';
$this->modal = 0;
$this->source_budget = 1;
$promotion = PromotionNames::select('mst_promotion.*','mst_promotion_form.form_field','mst_promotion_form.form_upload')
->where(['mst_promotion.promotion_id'=>$this->promotion])
->join('mst_promotion_form','mst_promotion_form.form_id','mst_promotion.form_id')->first();
----other code----
}
做同样的事情,即选择 select 选项并调用select_promotion()方法,livewire 时间请求不断增加,如下所示:
找了半天,发现方法调用执行异常,所以看起来同一个数据查询是这样执行的:
如何阻止它?即使我在方法 mount() 或 render() 中没有进程