为什么我的样式没有被应用到 EJS 文件和意外的令牌“<”错误显示在我的控制台上

我已经在我的 EJS 文件中包含了部分/页眉和页脚,我在其中通过我的 app.js 文件呈现了新的 Covid API 历史数据,但是 stye 没有被应用到我的 EJS 文件中,而是意外的令牌 '

app.js

 app.get('/history/:countryName',async (req,res) => {
    
        var countryName = req.params.countryName;
        countryName = countryName.toString();
        var history = await api.historical.countries({
            country: countryName,days:"all"
        });
        var historyCases = history.timeline.cases;
        var historyDeaths = history.timeline.deaths;
        var historyRecovered = history.timeline.recovered;
        for (var i in historyCases) {
            caseLabel.push(i);
            caseData.push(historyCases[i]);
        }
        for (var i in historyDeaths) {
            deathData.push(historyDeaths[i]);
        }
        for (var i in historyRecovered) {
            recoveredData.push(historyRecovered[i]);
        }
        let  formattedCountry = countryName.toUpperCase(); 
    
        res.render("country",{
            caseData,deathData,recoveredData,caseLabel,updatedFormatted,formattedCountry
        });
  
    })

country.ejs

<%- include("partials/header"); -%>

<section class="container-fluid">
    <div class="row justify-content-center">
        <div class="chartbox" style="width: 90%; height: 70vh;">
            <h2><%= formattedCountry  %> </h2>
            <canvas id="myChart"></canvas>
        </div>
    </div>
    
    <textarea name="" id="caseData" class="hiddenData"><%= caseData  %> </textarea>
    <textarea name="" id="deathData" class="hiddenData"><%= deathData  %> </textarea>
    <textarea name="" id="recoveredData" class="hiddenData"><%= recoveredData %> </textarea>
    <textarea name="" id="caseLabel" class="hiddenData"><%=caseLabel %></textarea>

</section>

<%- include("partials/footer"); -%>


<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

我在我的 EJS 文件中包含了 chart.js。图表显示正确,但样式未应用于我的 EJS 文件。

my header.ejs section

 <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <title>COVID19 Dashboard</title>
      <!-- Tables-->
      <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
    
      <!-- CSS-->
      <link rel="stylesheet" href="css/styles.css">
    
    </head>
    
    <body>

my footer.ejs

<!--  JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<!-- Tables-->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script  type="text/javascript"src="script/tables.js"></script>

</body>

</html>
tracyjuice 回答:为什么我的样式没有被应用到 EJS 文件和意外的令牌“<”错误显示在我的控制台上

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/11610.html

大家都在问