【问题标题】:Taghelpers with Bootstrap 4使用 Bootstrap 4 的标记助手
【发布时间】:2018-02-21 20:19:33
【问题描述】:

我正在尝试将 Bootstrap 4 集成到我的应用程序中。在我的 _Layout.cshtml 文件中,我有以下内容:

<link asp-href-include="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-href-exclude="**/*-reboot*,**/*-grid*" rel="stylesheet" />

我的凉亭配置文件:

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "bootstrap": "~4.0.0"
  }
}

我的 _ViewImports.cshtml(在 /Views 文件夹中,而不是 /Views/Shared 文件夹中)有

@addTaghelper *, Microsoft.AspNetCore.Mvc.Taghelpers

我的_ViewStart.cshtml 文件中有_Layout.cshtml

使用asp-href-includeasp-href-exclude taghelpers 时,引导链接似乎不起作用。不应用引导布局。当我使用基本的

<link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />

在我的_Layout.cshtml 中,应用了 Bootstrap,但不在我想要的布局中。如何集成 taghelper 以获得所需的设计?

【问题讨论】:

  • 您能否显示您的 wwwroot/lib 文件夹树视图?
  • @Ahmar wwwroot>>lib>>bootstrap>>dist>>css>>bootstrap.css>>bootstrap.min.css 我也刚刚拖放了 .css 文件并调整了taghelpers 以确保它指向正确的文件,但它没有帮助

标签: c# twitter-bootstrap asp.net-core asp.net-core-tag-helpers


【解决方案1】:

愚蠢的错误,将 TagHelpers 中的“H”大写修复了它

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-10
    • 2016-06-04
    • 2019-08-01
    • 1970-01-01
    相关资源
    最近更新 更多