import QtQuick 2.15 import Qt.labs.platform 1.1 import QtQuick.Layouts 1.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Dialogs 1.3 import FluentUI 1.0 import "qrc:///example/qml/component" import "../component" FluContentPage{ title:"Http" FluHttp{ id:http } Flickable{ id:layout_flick width: 160 clip: true anchors{ top: parent.top topMargin: 20 bottom: parent.bottom left: parent.left } ScrollBar.vertical: FluScrollBar {} contentHeight:layout_column.height Column{ spacing: 2 id:layout_column width: parent.width FluButton{ implicitWidth: parent.width implicitHeight: 36 text: "Get请求" onClicked: { var callable = {} callable.onStart = function(){ showLoading() } callable.onFinish = function(){ hideLoading() } callable.onSuccess = function(result){ text_info.text = result console.debug(result) } callable.onError = function(status,errorString){ console.debug(status+";"+errorString) } http.get("https://httpbingo.org/get",callable) } } FluButton{ implicitWidth: parent.width implicitHeight: 36 text: "Post表单请求" onClicked: { var callable = {} callable.onStart = function(){ showLoading() } callable.onFinish = function(){ hideLoading() } callable.onSuccess = function(result){ text_info.text = result console.debug(result) } callable.onError = function(status,errorString){ console.debug(status+";"+errorString) } var param = {} param.custname = "朱子楚" param.custtel = "1234567890" param.custemail = "zhuzichu520@gmail.com" http.post("https://httpbingo.org/post",callable,param) } } FluButton{ implicitWidth: parent.width implicitHeight: 36 text: "Post Json请求" onClicked: { var callable = {} callable.onStart = function(){ showLoading() } callable.onFinish = function(){ hideLoading() } callable.onSuccess = function(result){ text_info.text = result console.debug(result) } callable.onError = function(status,errorString){ console.debug(status+";"+errorString) } var param = {} param.custname = "朱子楚" param.custtel = "1234567890" param.custemail = "zhuzichu520@gmail.com" http.postJson("https://httpbingo.org/post",callable,param) } } FluButton{ implicitWidth: parent.width implicitHeight: 36 text: "Post String请求" onClicked: { var callable = {} callable.onStart = function(){ showLoading() } callable.onFinish = function(){ hideLoading() } callable.onSuccess = function(result){ text_info.text = result console.debug(result) } callable.onError = function(status,errorString){ console.debug(status+";"+errorString) } var param = "我命由我不由天" http.postString("https://httpbingo.org/post",callable,param) } } FluButton{ id:btn_download implicitWidth: parent.width implicitHeight: 36 text: "下载文件" onClicked: { folder_dialog.open() } } FluButton{ id:btn_upload implicitWidth: parent.width implicitHeight: 36 text: "文件上传" onClicked: { file_dialog.open() } } } } FileDialog { id: file_dialog onAccepted: { var param = {} for(var i=0;i