我正在尝试在VueJS函数中调用我的JQuery,但确实给了我TypeError错误:无法读取未定义的属性“ onload”。
<script>
import show from "C:/Users/vincent.dizon/Desktop/FrontEnd/frontend/public/show";
export default {
alertVin: function() {
show.window.onload()
},
clickMe: function() {
alert("YOU CLICKED ME");
}
}
</script>
这是我的 show.js
export var myFunction = window.onload = function () {
const btn = document.querySelector('#show-form');
const form = document.querySelector('.form');
const close = document.querySelector('.close-container');
btn.addEventListener('click', () => {
form.classList.add('form-show');
close.classList.add('x-show');
})
close.addEventListener('click', function () {
close.classList.remove('x-show');
form.classList.remove('form-show');
})
}
编辑:更新了SHOW.JS