判断手机端和pc端

时间:2021-05-25 18:31:07   收藏:0   阅读:0
 //判断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
            }
        },

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!