* [refac] refactor initial navigate state for independent page.

This commit is contained in:
sunhao
2024-06-24 16:17:45 +08:00
committed by 刘梦艺
parent 7b3fdd5f7a
commit b065d522bf
+6 -2
View File
@@ -51,7 +51,11 @@
if(title) document.title = title;
if(oldState && oldState.url === url) return;
if(oldState && oldState.url === url)
{
if(DEBUG) console.log('[APP]', 'skip update:', {oldState, state, code, url, title});
return;
}
window.history.pushState(state, title, url);
if(DEBUG) console.log('[APP]', 'update:', {code, url, title});
@@ -488,7 +492,6 @@
const selectors = (Array.isArray(options.selector) ? options.selector : options.selector.split(',')).map(selector => selector.replace(':component', ':type=json&data=props'));
const url = options.url;
if(DEBUG) console.log('[APP]', 'request', options);
if(DEBUG && !selectors.includes('zinDebug()')) selectors.push('zinDebug()');
const isDebugRequest = DEBUG && selectors.length === 1 || selectors[0] === 'zinDebug()';
if(options.modal === undefined) options.modal = $(target[0] !== '#' && target[0] !== '.' ? `#${target}` : target).closest('.modal').length;
@@ -684,6 +687,7 @@
}
}
});
if(DEBUG) console.log('[APP]', 'request', options);
if(currentCode) $.cookie.set('tab', currentCode, {expires: config.cookieLife, path: config.webRoot});
if(cacheKey)
{