我从事一个 ASP.net MVC项目,我有一个包含共享布局中某些部分的视图,我有三个共享布局视图,其中一个包含CSS文件,第二个包含Java脚本文件,第三个包含HTML代码,我用于将它们设置为视图的一部分。@RenderPage我的观点包含://html code@RenderPage("~/Views/Shared/_CssPage.cshtml")//html code@RenderPage("~/Views/Shared/_LeftSideBar.cshtml")//html code@RenderPage("~/Views/Shared/_JsPage.cshtml")_CssPage.cshtml : <!-- Favicon--><link rel="icon" href="favicon.ico" type="image/x-icon"><!-- Google Fonts --><link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css"><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css"><!-- Bootstrap Core Css --><link href="plugins/bootstrap/css/bootstrap.css" rel="stylesheet"><!-- Waves Effect Css --><link href="plugins/node-waves/waves.css" rel="stylesheet" /><!-- Animation Css --><link href="plugins/animate-css/animate.css" rel="stylesheet" /><!-- Morris Chart Css--><link href="plugins/morrisjs/morris.css" rel="stylesheet" /><!-- Custom Css --><link href="css/style.css" rel="stylesheet"><!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes --><link href="css/themes/all-themes.css" rel="stylesheet" />_LeftSideBar.cshtml : <!-- Left Sidebar --><aside id="leftsidebar" class="sidebar"> <!-- User Info --> <div class="user-info"> <div class="image"> <img src="images/user.png" width="48" height="48" alt="User" /> </div>
1 回答
天涯尽头无女友
TA贡献1831条经验 获得超9个赞
我认为CSS和JS文件的路径需要在链接之前添加。/
例:
原始路径为
<link href="plugins/morrisjs/morris.css" rel="stylesheet" />
您需要在链接之前添加,如下所示:slash
<link href="/plugins/morrisjs/morris.css" rel="stylesheet" />
希望这对你有所帮助。
添加回答
举报
0/150
提交
取消
