定制优化(episerver)阻止外部Div CSS类

发布于 2025-01-27 04:31:07 字数 442 浏览 4 评论 0原文

是否可以将CSS类添加到自动生成的外部DIV中? 我有一个带有ViewModel和一个控制器的简单块,我需要修改此自动化的外部Div,还是选择删除它?

我查看了推荐的其他答案,即。

@Html.PropertyFor(model => model.CurrentBlock.ClientLogos, new
{
    CustomTag = "ul",
    CssClass = "list",
    ChildrenCustomTagName = "li",
    ChildrenCssClass = "list_item"
})

问题是当我使用此语法时,模型没有CurrentBlock属性???

我的模型必将与ViewModel在一起,我不确定它是否会影响这一点。我是优化的新手。

Is it possible to add css classes to auto-generated outer div for block element ?
I have a simple Block with a ViewModel and a Controller and I need modify this autogenerated outer div, or optionally remove it?

I looked at other answers to this question where it was recommended ie.

@Html.PropertyFor(model => model.CurrentBlock.ClientLogos, new
{
    CustomTag = "ul",
    CssClass = "list",
    ChildrenCustomTagName = "li",
    ChildrenCssClass = "list_item"
})

Problem is when I use this syntax, model has no CurrentBlock property ???

My model is bound to ViewModel, I'm not sure if it affects this. I am very new to Optimizely.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺ぐ爱和你が 2025-02-03 04:31:07

您可以使用自定义标签和CSS类。在您的示例中,CurrentBlock可能是ViewModel的一部分,您可以直接使用Model.ClientLogs。替代性,如果您想要更多控件,则可以使用编辑属性。

<h1 @Html.EditAttributes(x => x.Heading)>
  /* Render the Heading property, unless it it empty, then use PageName as fallback */
  @Model.Heading ?? @Model.PageName
</h1>

您可以在此处找到有关编辑属性的更多信息: https://docs.developers.optimizely.com/content-cloud/v11.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 content-cloud/docs/docs/adding-eding-ighting-editing-editing-istribition-attributes-using-roperty-web-------------web--------控制

You can use custom tag and css class. In your example CurrentBlock is probably part of the viewModel, you can directly use model.ClientLogs. Alternativly if you want more control you can use editing attributes.

<h1 @Html.EditAttributes(x => x.Heading)>
  /* Render the Heading property, unless it it empty, then use PageName as fallback */
  @Model.Heading ?? @Model.PageName
</h1>

You can find more information about editing attributes here: https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/adding-editing-attributes-using-property-web-control

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文