点击打开一个修改信息的页面,同时显示已有的信息,由于layui 富文本编辑器设置初始化必须在build之前,所有每次点击修改的时候只有第一次点击会build,猜测可能是缓存问题,造成无法获取到数据,原因还是因为数据必须在build之前被设置进去。禁用该页面的浏览器缓存即可。 火狐不需要。ie chrome 都需要禁用,这可能是因为thymeleaf的问题 thymeleaf头是 模板是html5格式,非严格thymeleaf html5验证。
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1">。
添加头 或者在url后添加随机数Math.random()
<meta http-equiv="cache-control" content="no-cache,no-store, must-revalidate" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
下面是 thymeleaf 中 js 初始化必须是在构建富文本之前,否则无效
- <script type="text/javascript" th:inline="javascript">
- /* 只使用jquery */
- layui.use(['jquery','layer','form'],function(){
- var form = layui.form
- var $ = layui.jquery;
- $(document).ready(function(){
- var id = [[${#httpServletRequest.getParameter('id')}]]; //获取传过来的id值
- $.ajax({
- url: "../admin/blog/get" ,
- data: { 'id':id} ,
- type: "get" ,
- dataType:'json',
- success:function(result){
- if([[result.success]]){
- //location.reload();
- //已经到了这步了。