v-remote-js
在vue 单页应用中,引入远程js 和css 来避免全局引入的问题, 不支持IE
Install
npm install v-remote-js -S
Quick Start
在 mainjs 注册插件 使其成为一个全局组件Vue
<!-- 之后在每个xx.vue 文件中 写法如下 -->
// 支持加载多个远程资源,加载多个js 注意依赖顺序 { return hrefs:'http://xxx.css' srcArr:'http://xxxx1.js''http://xxxx2.js' } methods: // 远程js 加载完执行的回调 { // ...写你的逻辑 }