zoukankan      html  css  js  c++  java
  • vue引入第三方js 及css

    vue引入第三方js第一时间我们会想到在index.html下使用script标签引入,通常情况下script是可以满足我们的需求

    说的是通常会满足,作为写代码的我们,也有运气差的时候。写法、路劲都没有问题就是引入失败。这个时候我们就需要洗个头冷静下

    换个头脑,这不document给我们提供一个很好用的方法document.write()

    document.write() 用法

    在JavaScript中document.write()函数可以向文档写入HTML表达式或JavaScript代码,用法“document.write(exp1,exp2,exp3,…)”,该函数可接受任何多个参数,并将其写入文档中。
    
    document.write() 说明
    
    虽然根据 DOM 标准,该方法只接受单个字符串作为参数。
    
    我们通常按照两种的方式使用 write() 方法:一是在使用该方在文档中输出 HTML,另一种是在调用该方法的的窗口之外的窗口、框架中产生新文档。在第二种情况中,请务必使用 close() 方法来关闭文档。
    
    document.write() 实例
    
    <html>
    <body>
    // html <script type="text/javascript"> document.write("Hello World!"); </script> </body> </html>
    引入js(绝对路径)
        <script>
            document.write('<script src="/js/config.js?v=' + Math.random() + '"></script>');
            document.write('<script src="/js/mapvgl.js?v=' + Math.random() + '"></script>');
        </script>
    引入css
    <link rel="stylesheet" href="">
    必须要有rel="stylesheet" 
  • 相关阅读:
    String的几种初始化方法的区别
    Java编程思想之字符串
    树图 广度优先算法和深度优先算法
    bzoj1047: [HAOI2007]理想的正方形
    bzoj3124: [Sdoi2013]直径
    bzoj3930: [CQOI2015]选数
    bzoj1222: [HNOI2001]产品加工
    bzoj3578: GTY的人类基因组计划2
    bzoj4444: [Scoi2015]国旗计划
    bzoj1040: [ZJOI2008]骑士
  • 原文地址:https://www.cnblogs.com/huoshengmiao/p/15340395.html
Copyright © 2011-2022 走看看