美文网首页
VUE引入外部JS文件

VUE引入外部JS文件

作者: 苦咖啡Li | 来源:发表于2018-07-23 09:25 被阅读0次

1、需要修改引入的外部JS文件的格式

1.1在Vue中需要将模块抛出,让人们能够获得
function  a(){....}
export {
    a
}

1.2 我们需要到寄主那里,导入需要的js文件
<template>
    ...
</template>
<script>
    important { a } from '../../lib/myJs.js'
    export default(){
        methods:{
            func1 : function(){
                a{ ... }
            }
        }
    }
</script>

1.3 引入css文件
<template>
    ...
</template>
<style lang='scss'>
   important '../../lib/bootstrap.css'
</style>

相关文章

网友评论

      本文标题:VUE引入外部JS文件

      本文链接:https://www.haomeiwen.com/subject/onnfpftx.html