const isMobile = window.userAgent === 'mobile'; 在控制台输入console.log(window.userAgent) 会输出pc或者mobile(将pc浏览器设置成手机模式)