语法错误,意外的文件结尾,期待 elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) (View: .... \livewire\map-location.blade.php)

syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) (View: .... \livewire\map-location.blade.php)

怎么了?我检查了很多次,但是当 运行 时 if else.

出错了

”语法错误,文件意外结束,期待 elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) (View: D:\laragon\www\ta-atm\resources\views\livewire\map-location.blade.php)"

<div class="card-body">
  <form @if ($isEdit) wire:submit.prevent="updateLocation" @else wire:submit.prevent="saveLocation" @endif>
    <div class="row">
      <div class="col-sm-6">
        <div class="form-group">
          <label for="">Longitude</label>
          <input wire:model="long" type="text" class="form-control"> @error('long') <small class="text-danger">{{ $message }}</small>
        </div>
      </div>
      <div class="col-sm-6">
        <div class="form-group">
          <label for="">Latitude</label>
          <input wire:model="lat" type="text" class="form-control"> @error('lat') <small class="text-danger">{{ $message }}</small>
        </div>
      </div>
    </div>
    <div class="form-group">
      <label for="">Title</label>
      <input wire:model="title" type="text" class="form-control"> @error('title') <small class="text-danger">{{ $message }}</small>
    </div>
    <div class="form-group">
      <label for="">Description</label>
      <input wire:model="description" class="form-control"> @error('description') <small class="text-danger">{{ $message }}</small>
    </div>
    <div class="form-group">
      <label for="">Picture</label>
      <input wire:model="image" type="file" class="custom-file-input" id="customFile">
      <label class="custom-file-label" for="customFile">Choose file</label> @error('image') <small class="text-danger">{{ $message }}</small>
    </div>
    @if ($image)
    <img src="{{ $image->temporaryUrl() }}" class="img-fluid"> @endif @if ($imageUrl && !$image)
    <img src="{{ asset('/storage/images/' . $imageUrl) }}" class="img-fluid"> @endif
</div>
<div class="form-group">
  <button type="submit" class="btn btn-dark text-white btn-block">{{ $isEdit ? 'Update Location' : 'Submit Location' }}</button> @if ($isEdit)
  <button wire:click="deleteLocation" type="submit" class="btn btn-danger text-white btn-block">Delete Location</button> @endif
</div>
</form>
</div>
</div>
</div>
</div>

许多 Blade 指令在编译视图中成为特定的 if 语句。在这种情况下,您有 @error() 但没有 @enderror (也没有代码放在它们之间以在出现错误时显示)。见 @error directive documentation.