Inject Remote Js For Vue.js 2.
Select one option:
- Install using npm
npm install vue-inject-js --saveYou can omit the --save option if using npm@^5.
You can also use Yarn as:
yarn add vue-inject-jsIn your JavaScript file:
import VueInjectJs from 'vue-inject-js'- or -
var VueInjectJs = require('vue-inject-js')- Embed script tag
<script src="https://unpkg.com/vue-inject-js/dist/vue-inject-js.min.js"></script>Then register the component into Vue:
Vue.use(VueInjectJs)Using Inject Js is easy. The HTML code you need is the following:
<VueInjectJs src="https://unpkg.com/jquery@3.2.1/dist/jquery.js"/>And no JS code is needed whatsoever, Inject Js works out of the box.
The component needs some configuration, though. It's only one required option, so it remains pretty simple.
| Prop | Description | Type | Default |
|---|---|---|---|
| src | Remote Javascript source that will be loaded. | String | required |
Check out changelog file.
- @simamn The main author.
Feel free to contact me or create an issue
made with ♥