如何引入vsconsole

2,206 阅读1分钟
if (/\.djtest\.cn/.test(window.location.href)) {
        // 开发和测试环境,长按页面5秒,回弹出vconsole,用于debug
        let pressStart
        document.addEventListener('touchstart', () => { pressStart = Date.now() }, false)
        document.addEventListener('touchend', () => {
            if ((Date.now() - pressStart) > 5000) {
                import('vconsole').then((VConsole) => {
                    new VConsole()
                })
            }
        }, false)
    }