Failed to execute ‘readAsText‘ on ‘FileReader‘: parameter 1 is not of type ‘Blob‘.的解决方法

		把c.JSON(http.StatusOK,res)
替换成

resByte,_:=json.Marshal(res)
		//
		//c.JSON(http.StatusOK,res)


		c.Header("Content-Disposition", "attachment; filename=file-name.txt")
		c.Data(http.StatusOK, "application/octet-stream", resByte)

让它返回blob类型  大概是这样子的。

你可能感兴趣的:(go,前端,前端)