In the project, the previous jquery needs to be replaced by vue. The previous code was implemented using mobiscroll. Now the previous plug-in js is placed under index.html, but the Error in mounted hook is always reported on the homepage. : "ReferenceError: mobiscroll is not defined". Does this plug-in not support vue?
It always reports that the mobiscroll method does not exist. I can indeed click on the plug-in using webstrom, so dependency is not a problem. The js plug-in is introduced under index.html. If npm is not used, the error code is: initPage(){
var currYear = (new Date()).getFullYear();
mobiscroll.settings
$('#dataTime').mobiscroll().date({
theme : "android-holo",
mode : "scroller",
display : "bottom",
lang : "zh",
dateFormat : 'yyyy-mm-dd',
defaultValue : new Date(new Date().setFullYear(currYear - 30)),
startYear : currYear - 70,
endYear : currYear + 10
});
$(".checkbox-span").click(function() {
var idname = $(this).attr("id");
console.log(idname)
if (idname == "xz-checkbox") {
$(this).removeAttr("id");
$(".main-btn").attr("disabled", "disabled");
$(".main-btn").css("background", "#CCCCCC");
} else {
$(this).attr("id", "xz-checkbox");
$(".main-btn").removeAttr("disabled");
$(".main-btn").css("background", "");
}
})
$(".radio-p").click(function() {
$(".radio-p").removeAttr("id");
$(".radio-span").html("");
$(this).attr("id", "xz-radio-p");
$(this).children(".radio-span").html("<span></span>")
$("#userinfo").find("input[name='sex']").val($(this).data("sex"));
})
},
Place the mobiscroll plug-in (including css) in the js folder under common
Call in the component that needs to call Mobiscroll