Laravel Excel 未下载

Laravel Excel not downloading

这是我目前拥有的 导出 class

class ReportExcel implements FromArray, withHeadings
{
use Exportable;

protected $items;

public function __construct(array $items)
{
    $this->items= $items;
}

public function headings(): array
{
    return ["Opcion 1", "Opcion 2", "Opcion 3", "Nombres", "Apellidos", "Telefono", "Correo",
        "Pais", "Pais Otro", "Edad", "Adventista", "Estudia la Biblia", "Peticion", "Fecha"];
}

public function array(): array
{
    return $this->items;
}

}

我控制器中的方法

public function downloadExcel(Request $request)
{
    if ($request->country == null) {
        $item = Form::get(['option_1', 'option_2', 'option_3', 'name', 'lastname', 'phone',
            'email', 'country_id', 'country_other', 'age', 'adventist', 'study', 'petition', 'date_answered']);
    } else {
        $item = Form::where('country_id', $request->country)->orderByDesc('created_at')
            ->get(['option_1', 'option_2', 'option_3', 'name', 'lastname', 'phone', 'email', 'country_id',
                'country_other', 'age', 'adventist', 'study', 'petition', 'date_answered']);
    }

    $items[] = $item;

//   return (new ReportExcel($items))->download('invoices.csv', Excel::CSV,
//            ['Content-Type' => 'text/csv']);
    return Excel::download(new ReportExcel($items), 'reporte.csv');
}

我已经尝试过在我的控制器中看到的两种方式都没有下载任何我看到的东西,如果我将扩展名更改为 xlsxlsx 数据不可读,因为有很多在也出现的符号上

我做错了什么?我怎样才能得到它来下载实际的 excel 文件?

解决方案是使用 <a href=""/> 到路由而不是使用方法,因为它在通过 vue 发送请求时不起作用。其他代码正确。