window.onresize = () => {
return (() => {
let currentWidth = (document.documentElement.clientWidth || window.innerWidth)
this.$store.commit(‘SETSCREENWIDTH‘, currentWidth)
})()
}
原文:https://www.cnblogs.com/alantao/p/12464542.html