ace admin ajax加载页面,循环加载首页的解决办法
生活随笔
收集整理的這篇文章主要介紹了
ace admin ajax加载页面,循环加载首页的解决办法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ace admin 1.4
?
出現循環加載,主要是因為找不到頁面,
??
需要ajax加載的div
<div class="page-content-area" data-ajax-content="true"><!-- ajax content goes here --> </div>?
修改ace-1.4.0\assets\js\src\ace.basics.js
var demo_ajax_options = {'close_active': true,close_mobile_menu: '#sidebar',close_dropdowns: true,'default_url': 'page/index',//default hash'content_url': function(hash) {//***NOTE***//this is for Ace demo only, you should change it to return a valid URL//please refer to documentation for more infoif( !hash.match(/^page\//) ) return false;var path = document.location.pathname;//for example in Ace HTML demo version we convert /ajax/index.html#page/gallery to > /ajax/content/gallery.html and load itif(path.match(/(\/ajax\/)(index\.html)?/))return path.replace(/(\/ajax\/)(index\.html)?/, '/ajax/content/'+hash.replace(/^page\//, '')+'.html') ;//for example in Ace PHP demo version we convert "ajax.php#page/dashboard" to "ajax.php?page=dashboard" and load itreturn path + "?" + hash.replace(/\//, "=");} }?修改為自己的邏輯
'default_url': '/welcome',
return contextPath + hash; (contextPath是預置的)
var demo_ajax_options = {'close_active': true,close_mobile_menu: '#sidebar',close_dropdowns: true,// 'default_url': 'page/index',//default hash'default_url': '/welcome',//default hash'content_url': function(hash) { // //***NOTE*** // //this is for Ace demo only, you should change it to return a valid URL // //please refer to documentation for more info // // if( !hash.match(/^page\//) ) return false; // var path = document.location.pathname; // // //for example in Ace HTML demo version we convert /ajax/index.html#page/gallery to > /ajax/content/gallery.html and load it // if(path.match(/(\/ajax\/)(index\.html)?/)) // return path.replace(/(\/ajax\/)(index\.html)?/, '/ajax/content/'+hash.replace(/^page\//, '')+'.html') ; // // //for example in Ace PHP demo version we convert "ajax.php#page/dashboard" to "ajax.php?page=dashboard" and load it // return path + "?" + hash.replace(/\//, "=");if(hash==""){if(window.Pace && Pace.running) Pace.stop();$(this).ace_ajax('stopLoading', true);}return contextPath + hash;} }?
菜單欄說明
<a data-url="/welcome" href="#/welcome"><i class="menu-icon fa fa-tachometer"></i><span class="menu-text"> Dashboard </span> </a>href是鏈接
data-url 當前頁面地址與之對應時高亮選中
?
參考:
Ace Admin 使用教程
https://www.cnblogs.com/LeeScofiled/p/6733625.html
總結
以上是生活随笔為你收集整理的ace admin ajax加载页面,循环加载首页的解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RabbitMQ 资料整理
- 下一篇: 直击中关村创业大街,新街头霸王来了