提交 db120ff4 authored 作者: shixiaochen's avatar shixiaochen

1、js互调方法finishPage(关闭页面);

上级 9e2c5782
...@@ -62,6 +62,12 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> { ...@@ -62,6 +62,12 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> {
// #enddocregion platform_features // #enddocregion platform_features
controller controller
..setJavaScriptMode(JavaScriptMode.unrestricted) ..setJavaScriptMode(JavaScriptMode.unrestricted)
..addJavaScriptChannel("finishPage",
onMessageReceived: (JavaScriptMessage message) async {
debugPrint(
"JavascriptChannel:method = finishPage message = ${message.message}");
finishPage(message.message);
})
..setNavigationDelegate( ..setNavigationDelegate(
NavigationDelegate(onPageFinished: _onPageFinished)) NavigationDelegate(onPageFinished: _onPageFinished))
..loadRequest(Uri.parse(widget.url ?? "")); ..loadRequest(Uri.parse(widget.url ?? ""));
...@@ -162,4 +168,10 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> { ...@@ -162,4 +168,10 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> {
debugPrint("web onPageFinished:title = $_title url = ${widget.url}"); debugPrint("web onPageFinished:title = $_title url = ${widget.url}");
setState(() {}); setState(() {});
} }
/// 关闭页面
finishPage(String? msg) {
debugPrint("finishPage:");
Navigator.pop(context);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论