vue引用外部js文件

1.一般在.vue文件引用js文件都是通过import方式,但是这个前提是对应的js有export

2.遇到没有npm方式安装的js库时,可直接在index.html引用外部的js库,与传统html页面引入js文件一致,可以在任何一个.vue项目都能访问

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <script type="text/javascript" src="引用的文件路径"></script>
<!--    <link rel="icon" href="<%= BASE_URL %>favicon.ico">-->
    <!--    禁止favicon的访问-->
    <link rel="icon" href="data:image/ico;base64,aWNv">
<!--    <link rel="stylesheet" href="//at.alicdn.com/t/font_1180008_6vn2ce2lu3l.css">-->
    <title></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but iview-admin doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auxto injected -->
  </body>
</html>

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页