Example #1
0
        /// <summary>
        /// 合并并添加样式名称。
        /// </summary>
        /// <param name="output">表情输出实例对象。</param>
        /// <param name="context">当前标签上下文实例对象。</param>
        /// <param name="classNames">需要添加合并的样式名称。</param>
        public static void MergeClassNames(this TagHelperOutput output, TagHelperContext context,
                                           params string[] classNames)
        {
            if (classNames == null)
            {
                return;
            }
            var htmlClassNames = context.GetClassNames();

            htmlClassNames.AddRange(classNames);
            output.Attributes.SetAttribute("class", string.Join(" ", htmlClassNames.Distinct()));
        }