layuiadmin新建tabs标签页,点击保存,打开新的标签页并刷新

用的layuiamin前端框架
需求:新增的页面为一个标签页,保存后,需要刷新列表
在这里插入图片描述

1、新建customMethod.js文件,自定义自己的方法

layui.define(function (exports) {
  var $ = layui.$
  var customMethod = {
    // 表单点击保存后,新表单当前页,并新开标签页刷新
    reload: function (link,title) {
      top.layui.index.openTabsPage(link, title); //打开新标签页
      setTimeout(function () {
        // 刷新当前页面
        location.reload();
        // 刷新新开标签页
        var src = $("#LAY_app_body .layadmin-tabsbody-item.layui-show>iframe", parent.document).attr("src")
        // console.log("122", src);
        $("#LAY_app_body .layadmin-tabsbody-item.layui-show>iframe", parent.document).attr("src", src)
      }, 100)
    },

    init: function (some) {
      console.log("其它公用方法")
    },

  };

  exports('customMethod', customMethod);
})

2、找到config.js文件,引入自定义方法
//扩展的第三方模块
,extend: [
‘customMethod’,//公用文件
‘echarts’, //echarts 核心包
‘echartsTheme’ //echarts 主题
]

3、在需要使用html页面use模块

<script>

    layui.config({

      base: '../../layuiadmin/' //静态资源所在路径

    }).extend({

      index: 'lib/index' //主入口模块

    }).use(['index', 'console','customMethod'], function () {
      var $ = layui.$
        , setter = layui.setter
        , admin = layui.admin
        , form = layui.form
        , router = layui.router()
        , search = router.search
        , customMethod = layui.customMethod;
        console.log("当前")
      $("#aaa").click(function () {
        customMethod.reload("home/homepage1.html","主页一")
      })
      
    //在提交保存的地方
  //customMethod.reload("{:url('ditch/channel/channelList')}", "渠道列表");//打开列表

    });

  </script>

4、

最近更新

  1. TCP协议是安全的吗?

    2024-01-03 10:46:08       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-03 10:46:08       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-03 10:46:08       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-03 10:46:08       18 阅读

热门阅读

  1. k8s安装hostPath方式存储的PostgreSQL15

    2024-01-03 10:46:08       39 阅读
  2. 2023.12.30力扣每日一题——一周中的第几天

    2024-01-03 10:46:08       43 阅读
  3. 牙科废水处理设备详细介绍

    2024-01-03 10:46:08       38 阅读
  4. C++汇编语言学习计划

    2024-01-03 10:46:08       39 阅读
  5. PDF最强处理工具-StirlingPDF

    2024-01-03 10:46:08       40 阅读
  6. Laya3d碰撞后退表现算法

    2024-01-03 10:46:08       42 阅读
  7. 5分钟带你解决Promise疑难杂症

    2024-01-03 10:46:08       34 阅读
  8. pytorch 转 onnx

    2024-01-03 10:46:08       32 阅读
  9. flask web学习之flask与http(四)

    2024-01-03 10:46:08       35 阅读
  10. torch.where用法介绍

    2024-01-03 10:46:08       37 阅读
  11. 构建一个动态时钟

    2024-01-03 10:46:08       34 阅读