html 自适应模板 (webview)

html 自适应模板+清缓存

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0044)http://jst.gdbnet.cn/am-prodportal/down.html -->
<html xmlns="http://www.w3.org/1999/xhtml" >
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires"  content="0">

<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport">
<title>XXX</title>

</head>
<body>


</body>

</html>

 文档转HTML

http://kindeditor.net/demo.php

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要让Flutter WebView组件自适应高度,可以使用IntrinsicHeight和LayoutBuilder组件来实现。具体实现步骤如下: 1. 在WebView外面包裹一个IntrinsicHeight组件,让WebView的高度自适应它的子组件的最大高度。 2. 在WebView内部使用LayoutBuilder组件,获取WebView的实际高度,并将实际高度保存在一个变量中。 3. 将WebView的高度设置为保存的实际高度,这样WebView的高度就能够自适应了。 下面是一个示例代码: ```dart import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; class MyWebView extends StatefulWidget { final String url; const MyWebView({Key key, this.url}) : super(key: key); @override _MyWebViewState createState() => _MyWebViewState(); } class _MyWebViewState extends State<MyWebView> { double _webViewHeight; @override void initState() { super.initState(); _webViewHeight = 1.0; } @override Widget build(BuildContext context) { return IntrinsicHeight( child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return WebView( initialUrl: widget.url, javascriptMode: JavascriptMode.unrestricted, onPageFinished: (String url) { setState(() { _webViewHeight = double.parse( "document.documentElement.scrollHeight.toString()"); }); }, gestureNavigationEnabled: true, navigationDelegate: (NavigationRequest request) { return NavigationDecision.navigate; }, onWebResourceError: (err) { print(err); }, javascriptChannels: <JavascriptChannel>[ JavascriptChannel( name: 'Print', onMessageReceived: (JavascriptMessage message) { print(message.message); }), ].toSet(), ); }, ), ); } } ``` 在这个示例代码中,我们使用了IntrinsicHeight和LayoutBuilder组件来实现WebView自适应高度。在布局中,我们首先将WebView包裹在一个IntrinsicHeight组件中,然后在WebView内部使用LayoutBuilder组件获取WebView的高度,并在页面加载完成后更新WebView的高度。这样,WebView就可以自适应高度了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值