在天津项目下添加aj的页签按照页面显示title功能
Showing
1 changed file
with
29 additions
and
3 deletions
@@ -134,11 +134,35 @@ layui.extend({ | @@ -134,11 +134,35 @@ layui.extend({ | ||
134 | 134 | ||
135 | } | 135 | } |
136 | }); | 136 | }); |
137 | + var tabName; | ||
138 | + //start lsq 页面刷新后名称改变,把aj得存储到localStorage中 2022-04-18 | ||
139 | + let routerPath=router.path; | ||
140 | + if(routerPath.indexOf('ajConfig')!=-1 && routerPath.indexOf('view')!=-1 && !localStorage.getItem(router.search.ajConfig)){ | ||
141 | + localStorage.setItem(router.search.ajConfig,admin.tabsPage.elem.text()); | ||
142 | + } | ||
143 | + try { | ||
144 | + let el = admin.tabsPage.elem; | ||
145 | + if(el && el.attr('lay-href-type')){ | ||
146 | + if(el.attr('lay-href-type') == 'menu' && !matchTo){ | ||
147 | + tabName= admin.tabsPage.elem.text(); | ||
148 | + } | ||
149 | + } | ||
150 | + } catch (e){ | ||
151 | + } | ||
152 | + if(!tabName){ | ||
153 | + | ||
154 | + if(routerPath.indexOf('ajConfig')!=-1 && routerPath.indexOf('view')!=-1){ | ||
155 | + tabName=localStorage.getItem(router.search.ajConfig); | ||
156 | + }else{ | ||
157 | + tabName= res.title | ||
137 | 158 | ||
159 | + } | ||
160 | + } | ||
161 | + //end lsq 页面刷新后名称改变 2022-04-18 | ||
138 | //如果未在选项卡中匹配到,则追加选项卡 | 162 | //如果未在选项卡中匹配到,则追加选项卡 |
139 | if(setter.pageTabs && pathURL !== '/'){ | 163 | if(setter.pageTabs && pathURL !== '/'){ |
140 | if(!matchTo){ | 164 | if(!matchTo){ |
141 | - var tabName='' // tab标签名 | 165 | + /*var tabName='' // tab标签名 |
142 | var url=pathURL.substring(1) | 166 | var url=pathURL.substring(1) |
143 | tabList.forEach((e) =>{ | 167 | tabList.forEach((e) =>{ |
144 | if(url === e.path){ | 168 | if(url === e.path){ |
@@ -147,7 +171,7 @@ layui.extend({ | @@ -147,7 +171,7 @@ layui.extend({ | ||
147 | }); | 171 | }); |
148 | if(!tabName){ | 172 | if(!tabName){ |
149 | tabName= res.title | 173 | tabName= res.title |
150 | - } | 174 | + }*/ |
151 | $(APP_BODY).append('<div class="layadmin-tabsbody-item layui-show"></div>'); | 175 | $(APP_BODY).append('<div class="layadmin-tabsbody-item layui-show"></div>'); |
152 | tabsPage.index = tabs.length; | 176 | tabsPage.index = tabs.length; |
153 | element.tabAdd(FILTER_TAB_TBAS, { | 177 | element.tabAdd(FILTER_TAB_TBAS, { |
@@ -164,7 +188,9 @@ layui.extend({ | @@ -164,7 +188,9 @@ layui.extend({ | ||
164 | 188 | ||
165 | //定位当前tabs | 189 | //定位当前tabs |
166 | element.tabChange(FILTER_TAB_TBAS, pathURL); | 190 | element.tabChange(FILTER_TAB_TBAS, pathURL); |
167 | - admin.tabsBodyChange(tabsPage.index); | 191 | + // 修改为当前菜单名称 lsq 2022-04-18 |
192 | + $('* [lay-id="' + pathURL + '"] span').text(tabName) | ||
193 | + admin.tabsBodyChange(tabsPage.index); | ||
168 | 194 | ||
169 | }).done(function(){ | 195 | }).done(function(){ |
170 | layui.use('common', layui.cache.callback.common); | 196 | layui.use('common', layui.cache.callback.common); |
-
Please register or login to post a comment