Exemple #1
0
        /// <summary>
        /// 设置Dom元素的CSS样式
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task UpdateCss(string id, CssBuild css)
        {
            css.NullCheck();
            // 加载 DOMTokenList
            var src = await JsRuntime.InvokeAsync <CssData>("ThunderBlazor.CssBuilder.ClassList", id).ConfigureAwait(true);

            css.Build();
            // 处理移除项目
            var remove = css.CssRemove.Intersect(src.list).ToList();
            await JsRuntime.InvokeAsync <object>("ThunderBlazor.CssBuilder.Remove", new CssData { id = id, list = remove }).ConfigureAwait(true);

            // 处理添加项目
            await JsRuntime.InvokeAsync <object>("ThunderBlazor.CssBuilder.Add", new CssData { id = id, list = css.CssList }).ConfigureAwait(true);
        }
 public static CssBuild Add(this CssBuild css, Enum val, bool condition = true)
 {
     css.NullCheck();
     return(css.Add(val.ToDescriptionString(), condition));
 }