Use external js in vue-cli

beginners, using vue-cli to write the front end, because of the need for a side menu bar, found a very good template:
idebar-menu" rel=" nofollow noreferrer "> https://github.com/huang-x-h/.
this template is very simple, the home directory only has html files, a js file and a css file, and uses jquery at the same time.
it"s OK to open html, directly locally, but there"s a big problem with moving to a vue-cli project.
in the original html page:
clipboard.png
js
$.sidebarMenu($(".sidebar-menu"))
menu.vue:
clipboard.png
I copied this sentence in mounted, and then transferred the contents of the js file to
in methods (there is only one function in the js file $sidebarMenu )
at this time . error report:
Syntax Error: Unexpected token, expected,
, but this in itself is just unknown. So I changed the function name to $_ sidebarMenu (both mounted and methods )
error report transferred to $_ sidebarMenu = function (menu) { in the first sentence $_ sidebarMenu = in methods .
if you change this sentence to $_ sidebarMenu:function (menu) { or $_ sidebarMenu (menu) {, the error will disappear, but the template menu will not run correctly, and the runtime will report an error that is not defined by the function $_ sidebarMenu .
I really don"t know how to deal with these problems:
1, why does the function name of $.sidebarMenu report an error? Is it not possible to define a function like
2, $_ sidebarMenu = function (menu)?
3, why did you finally report that the function is undefined?

Mar.11,2021

Sorry, I didn't read the code carefully before. This is the revised answer. I think the reason why the
reported an error is that you imported it. Jquery official documents are recommended to be used in documents containing webpack:

var $ = require("jquery");

Import Jquery. The import method will report an error, and the error will be sent by you.

as for the reason why there is no error in the mounted function, but the error is reported in methods , I think it is because of the compilation order. methods will be compiled before mounted . For more information, please see the Lifecycle Hook section of the official website. The address is as follows:
ide/instance.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide/instance.html

.

I hope it will be helpful to you ~

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dc15-2c3ae.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dc15-2c3ae.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?