- 刚开始写的代码
const _that=this;
window.onresize = function() {
if (!_that.checkFull()) {
//要执行的动作
$("#canvasPaintArea").css("position","static").css("width","100%");
$(".buildingsFloor").css("width","70%");
$(".floor-plan").css("width","78%");
_that.isFullscreen=true;
}
}
发现监听窗体变化不稳定,时好时坏;
- 后来将代码改成现在的样子就好了
const _that=this;
window.addEventListener('resize', function() {
if (!_that.checkFull()) {
//要执行的动作
$("#canvasPaintArea").css("position","static").css("width","100%");
$(".buildingsFloor").css("width","70%");
$(".floor-plan").css("width","78%");
_that.isFullscreen=true;
}
})
不知道是什么原因,哪位大佬知道的请在下面留言;感激不尽!!!