判断手机端和pc端

 //判断pc和手机
        browserRedirect() {
            var sUserAgent = navigator.userAgent.toLowerCase();
            if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(sUserAgent)) {
                //移动端页面
                this.viwe = 1
            } else {
                //pc端页面
                this.viwe = 2
            }
        },

 

posted @ 2021-05-25 13:40  小灬壊  阅读(127)  评论(0编辑  收藏  举报