Import functions from another js file. Javascript

前端 未结 5 951
臣服心动
臣服心动 2020-12-02 23:02

I have a question about including a file in javascript. I have a very simple example:

--> index.html
--> models
      --> course.js
      --> s         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 23:43

    From a quick glance on MDN I think you may need to include the .js at the end of your file name so the import would read import './course.js' instead of import './course'

    Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

提交回复
热议问题