我只想让 Ajax 请求从 REACT.JS 中的 API 获取数据,但是每个 API 都需要(id),我想从浏览器中的 URL 获取该 id,我该怎么做?这是我的代码:
componentDidMount(){
fetch("http://localhost:8000/personal/1")
.then(res => res.json())
.then(json => {
this.setState({
isLoaded: true,
information: json,
})
})
Run Code Online (Sandbox Code Playgroud)
我通过 Laravel 制作了 API,并且上面这段代码的一切都很好,但正如我所说,我想从浏览器中的 url 获取 id,而不仅仅是像现在这样写,谢谢:) }
使用 GetX (或任何其他方式)在 flutter 中发送带有参数的数据是一个好习惯吗?我的意思是它对性能和内存容量有好处吗?...就像这个例子:
Get.toNamed(AppPages.servicesDetails, arguments: [service]);
Run Code Online (Sandbox Code Playgroud)
当(服务)仅包含来自 API 的一种产品的数据时:例如(id、名称、信息、图像...等)。
并在服务详细信息页面中:
final s = Get.arguments[0];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(child: Text(s.name),),
Run Code Online (Sandbox Code Playgroud) 我有如下图所示的表格,它从右侧溢出,如何添加滚动,我正在使用 Tailwind CSS,如以下代码所示:
<table class="table-auto overflow-scroll">
<thead>
<tr class="bg-gray-100">
<th class="w-20 px-4 py-2">No.</th>
<th class="px-4 py-2">First Name</th>
<th class="px-4 py-2">Second Name</th>
<th class="px-4 py-2">Third Name</th>
<th class="px-4 py-2">Department</th>
<th class="px-4 py-2">Stage</th>
<th class="px-4 py-2">Email</th>
<th class="px-4 py-2">Roles</th>
<th class="px-4 py-2">status</th>
<th class="px-4 py-2">University Email</th>
<th class="px-4 py-2">University Password</th>
<th class="px-4 py-2">Students Files</th>
<th class="px-4 py-2">Actions</th>
</tr>
</thead>
<tbody>
@if(isset($users)) @include('dashboard.users.partials.users_details') @endif
@if(isset($searches)) @include('dashboard.users.partials.search') @endif
@if(isset($statusSearch)) @include('dashboard.users.partials.status_search') @endif
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我在使用google_maps_flutter: ^0.0.3+3带有颤振的插件时遇到错误。
我完成了在 androidmanifest或 ios 上使用谷歌地图的所有要求runner。
这是我的地图代码
GoogleMap(onMapCreated: (GoogleMapController controller) {},
options: GoogleMapOptions(
cameraPosition: CameraPosition(
target: LatLng(36.382013, 43.143249),
),
mapType: MapType.normal,
),
),
Run Code Online (Sandbox Code Playgroud)
错误是这样的:
W/ResourcesManager( 9743): getTopLevelResources: /data/app/com.example.mis-2/base.apk / 1.0 running in com.example.mis rsrc of package null
I/zzbz ( 9743): Making Creator dynamically
I/DynamiteModule( 9743): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
I/DynamiteModule( 9743): Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
W/ResourcesManager( 9743): getTopLevelResources: /data/app/com.google.android.gms-4/base.apk / 1.0 running in com.example.mis rsrc of …Run Code Online (Sandbox Code Playgroud) 我制作了一个颤振应用程序,首先我显示有关 pdf 文件的所有信息,它包括文件的 url,来自 Restfull API,一切正常,但我想在用户点击它时下载这个文件,我试试这个:
onTap: () async {
// downloadFile(snapshot.data[index].file);
Dio dio = new Dio();
Directory dir =
await getApplicationDocumentsDirectory();
String path = dir.path;
await dio.download(
snapshot.data[index].file, path);
},
Run Code Online (Sandbox Code Playgroud)
snapshot.data[index].file, path 是来自api的正确路径或文件,但它不起作用,并在此代码中给我一个错误(路径)
await getApplicationDocumentsDirectory();
String path = dir.path;
this is my error log:
E/flutter (26482): [ERROR:flutter/shell/common/shell.cc(188)] Dart Error: Unhandled exception:
E/flutter (26482): FileSystemException: Cannot open file, path = '/data/data/com.example.mis/app_flutter' (OS Error: Is a
directory, errno = 21)
E/flutter (26482): #0 _File.throwIfError (dart:io/file_impl.dart:647:7)
E/flutter (26482): #1 _File.openSync (dart:io/file_impl.dart:491:5)
E/flutter …Run Code Online (Sandbox Code Playgroud) flutter ×3
laravel ×2
arguments ×1
css ×1
dart ×1
docker ×1
download ×1
flutter-getx ×1
html ×1
hyper-v ×1
performance ×1
reactjs ×1
tailwind-css ×1