示例#1
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var item = new TagBuilder("div", "chat-item");

            onRender?.Invoke(item);
            MergeAttributes(item, context, MergeAttrMode.Visibility);
            item.RenderStart(context);

            var h = new TagBuilder("div", "chat-header");

            h.RenderStart(context);
            TagBuilder.RenderSpanText(context, "chat-user", GetBinding(nameof(User)), User);
            TagBuilder.RenderSpanText(context, "chat-time", GetBinding(nameof(Time)), Time);
            RenderAddOns(context);
            h.RenderEnd(context);

            TagBuilder cont     = new TagBuilder("span", "chat-body");
            var        contBind = GetBinding(nameof(Content));

            if (contBind != null)
            {
                cont.MergeAttribute("v-text", contBind.GetPathFormat(context));
            }
            cont.RenderStart(context);
            RenderContent(context, Content);
            cont.RenderEnd(context);
            item.RenderEnd(context);
        }