vue 自动识别PC、移动端,并跳转到对应页面

方法一:

index.html中head添加

 

方法二:

app.vuehead中添加

    
    
        

static文件夹中创建js文件夹,添加以下内容

function uaredirect(murl){
try {
if(document.getElementById("bdmark") != null){
return;
}
var urlhash = window.location.hash;
if (!urlhash.match("fromapp")){
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) {
location.replace(murl);
}
}
} catch(err){}
}

 

转载于:https://www.cnblogs.com/duanzhenzhen/p/10672631.html

你可能感兴趣的:(vue 自动识别PC、移动端,并跳转到对应页面)