How to reference the js method in external links in a vue single page file

my front-end project is built directly using vue scaffolding and vue-cli. At present, I only know that you can import a js file into the .vue page through the import "xxx.js" file, and then I would like to ask how to introduce the outer chain? I tried to introduce it directly into the index.html file, but I can"t seem to access the link in a single-page file (xxx.vue).
I mean links like https://code.jquery.com/jquery-3.3.1.min.js, which are updated in real time by partners, so they can only use their js method by introducing links

.

refer to head in index.html, and then add a sentence
Vue.prototype.xxx = xxx
in the main.js under the src directory, in which xxx is the js exposed object of your chain
usage:
this.xxx.alert ('h')


Yes, just write it in index.html


save it locally and then reference it, and the require parsed by import is just looking for resources locally.


you can try
the first step
npm install jquery-- save

step 2
add

to build/webpack.base.conf.js

var webpack = require ("webpack")
step 3
also in build/webpack.base.conf.js
add
plugins: at the end of the module.exports [

new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
    jQuery: "jquery",
    $: "jquery",
    "windows.jQuery": "jquery"
})

]
step 4
introduce import $from 'jquery' in main.js

step 5
npm run dev restart the server


I mean that the path is already supported, and it is also an outer chain. As for the local . / my-module.js , you are actually adding http://url/ to the browser.

index.html

<script type="module">
import {foo} from "http://url/my-module.js";

console.log(foo)
</script>

my-module.js

export const foo = Math.PI + Math.SQRT2;

can't it be directly introduced into html? I remember that the js of the geographical location analysis of QQ that I cited earlier was so directly cited.

Menu