public void AddPageHeadCodeIfNotExists(string pageJsName) { if (!HeadCodes.ContainsKey(pageJsName)) { HeadCodes.Add(pageJsName, GetJsCode(pageJsName)); } }
public async Task AddPageHeadCodeIfNotExistsAsync(string pageJsName) { if (!HeadCodes.ContainsKey(pageJsName)) { HeadCodes.Add(pageJsName, await GetJsCodeAsync(pageJsName)); } }
/// <summary> /// 将一个页面的js从本页面去除,提供给分页时使用 /// add by sessionliang at 20151209 /// </summary> /// <param name="lastPageInfo"></param> public void ClearLastPageScript(PageInfo lastPageInfo) { foreach (var key in lastPageInfo.BodyCodes.Keys) { BodyCodes.Remove(key); } foreach (var key in lastPageInfo.FootCodes.Keys) { FootCodes.Remove(key); } foreach (var key in lastPageInfo.HeadCodes.Keys) { HeadCodes.Remove(key); } }
/// <summary> /// 将一个页面的js复制给本页面,提供给分页时使用 /// add by sessionliang at 20151209 /// </summary> /// <param name="lastPageInfo"></param> public void AddLastPageScript(PageInfo lastPageInfo) { foreach (var key in lastPageInfo.BodyCodes.Keys) { if (!BodyCodes.ContainsKey(key)) { BodyCodes.Add(key, lastPageInfo.BodyCodes[key]); } } foreach (var key in lastPageInfo.FootCodes.Keys) { if (!FootCodes.ContainsKey(key)) { FootCodes.Add(key, lastPageInfo.FootCodes[key]); } } foreach (var key in lastPageInfo.HeadCodes.Keys) { if (!HeadCodes.ContainsKey(key)) { HeadCodes.Add(key, lastPageInfo.HeadCodes[key]); } } }
/// <summary> /// 清理本页面的js /// </summary> public void ClearLastPageScript() { HeadCodes.Clear(); BodyCodes.Clear(); FootCodes.Clear(); }