美文网首页
Vue 组件内引入外部在线js、css

Vue 组件内引入外部在线js、css

作者: 前端召唤师 | 来源:发表于2019-07-10 18:05 被阅读0次

参考:https://blog.csdn.net/u010881899/article/details/80895661

例:引入element-ui

js:

mounted() {
    const oScript = document.createElement('script');
    oScript.type = 'text/javascript';
    oScript.src = 'https://unpkg.com/element-ui@2.3.7/lib/index.js';
    document.body.appendChild(oScript);
}

css:

<style scoped>
    @import 'https://unpkg.com/element-ui@2.3.7/lib/theme-chalk/index.css';
</style>

相关文章

网友评论

      本文标题:Vue 组件内引入外部在线js、css

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