上一篇简单的介绍了css js加载通用方法

_Layout.cshtml

<html>
<head>
<title>xx-用户中心</title>
@Style.Css("/css/globalv3.0.css", this.Url)
@Style.Css("/css/incv3.0.1.css", this.Url)
@Style.Css("/css/personal/memberv3.0.1.css", this.Url)
@Style.Script("/script/jquery.js", this.Url)
@Style.Script("/script/member.js", this.Url)
@if (IsSectionDefined("header")) //判断下子页面是否有这个属性
{
@RenderSection("header", true);//这个用Section这个特性起一个占位的作用 方便后面的子页面可以把自己的样式或者其他插入到这里

}
</head>


a.cshtm

@section header{
@Style.Css("/offerstyle/css/offer-manage.css", this.Url)
@Style.Script("/script/formValidator.js", this.Url)
@Style.Script("/script/formValidatorRegex.js", this.Url)
}

这样a.cshtm自己的样式就插到<head></head>中了

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
相关资源
相似解决方案