国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

標(biāo)題重寫為:預(yù)期的JavaScript模塊腳本,但服務(wù)器響應(yīng)的MIME類型為text/html和text/css - 無框架,純JS
P粉481035232
P粉481035232 2023-11-22 18:58:51
0
1
999

我正在嘗試使用顏色日歷,并且我正在按照他們在演示和文檔中看到的教程進(jìn)行操作,如下所示:

// js/calendar.js

import Calendar from '../node_modules/color-calendar';
import '../node_modules/color-calendar/dist/css/theme-glass.css';

let calA = new Calendar({
  id: "#color-calendar",
  theme: "glass",
  // border: "5px solid black",
  weekdayType: "long-upper",
  monthDisplayType: "long",
  // headerColor: "yellow",
  // headerBackgroundColor: "black",
  calendarSize: "small",
  layoutModifiers: ["month-left-align"],
  eventsData: [
    {
      id: 1,
      name: "French class",
      start: "2020-12-17T06:00:00",
      end: "2020-12-18T20:30:00"
    },
    {
      id: 2,
      name: "Blockchain 101",
      start: "2020-12-20T10:00:00",
      end: "2020-12-20T11:30:00"
    },
    {
      id: 3,
      name: "Cheese 101",
      start: "2020-12-01T10:00:00",
      end: "2020-12-02T11:30:00"
    },
    {
      id: 4,
      name: "Cheese 101",
      start: "2020-12-01T10:00:00",
      end: "2020-12-02T11:30:00"
    }
  ],
  dateChanged: (currentDate, events) => {
    console.log("date change", currentDate, events);
  },
  monthChanged: (currentDate, events) => {
    console.log("month change", currentDate, events);
  }
});

和我的 HTML:

// dashboard.html
...
<div class="col">
  <div class="calendar-container">
    <div id="color-calendar"></div>
    <div id="events-display"></div>
  </div>
</div>
...
<script type="module" src="js/calendar.js"></script>

我嘗試使用 http-server 和 Live Server 擴(kuò)展來檢查它是否解決了問題,但問題仍然存在。

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/css". Strict MIME type checking is enforced for module scripts per HTML spec.

我在我的開發(fā)工具控制臺上得到了這兩個

有關(guān)其他信息,這是我的 package.json

{
  "dependencies": {
    "color-calendar": "^1.0.7",
    "http-server": "^14.1.1"
  }
}

我不知道該怎么辦了...沒有 Node.js,沒有框架,只是使用 javascript、html 和 css。

P粉481035232
P粉481035232

全部回復(fù)(1)
P粉254077747

Konrad 和 Stefino76 帶來的解決方案奏效了。

我在我的項目上安裝了 webpack 并將其配置為接受 .js 文件中的 js 和 css,現(xiàn)在日歷可以正常工作了!

所有的功勞都應(yīng)該歸功于他們,但我認(rèn)為我無法將他們的答案標(biāo)記為已解決。

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板