In Vue, how to realize the effect that < script > in html is introduced into js file in component.

as shown in the figure, most of the online search methods have been tried, but they still don"t work, such as this

.

clipboard.png

< H3 > still reported an error, saying that it could not be found, emmmmm. There are a lot of copy and paste on the Internet. Anyway, I don"t understand it. I hope with the help of the boss, Mengxin is very uncomfortable.
Apr.13,2022

put the files under static/js into the src directory and introduce them through relative paths or alias stitching.

...
src
    page
        xxx.vue
    script
        xxx.js
static
    js
        xxx.js
        

above is the directory tree structure. Put the js library you want to introduce into xxx.vue under src/script/, and then write

in xxx.vue.
    import xxx from './script/xxx.js'

the above is the solution to the problem. Here is the following:
if you are importing a third-party library globally, just import it directly in the import file main.js or through the script tag in index.html.
if you need partial import, it is recommended to download it through npm install and then import it

Menu