h5和app原生联调触发方法

        //路径跳转
        urlHref(item) {//人物、访谈、动态是一个页面
            var para = {};
            para.title = "动态详情";
            para.type = "searchDetails";
            if(this.type == 10){//二手
                para.url = '/PageClassify/html/Substation/secondhand/secondhandDetails.html?id='+ item.id;  
            }else if(this.type == 9){//心情
                para.url = '/PageClassify/html/Substation/Dynamic/mooddetail.html?id=' + item.id;
            }else{//人物 访谈 动态
                para.url = '/PageClassify/html/Substation/Dynamic/subDynamicDetails.html?id=' + item.id;
            }
           
            
            if (/(Android)/i.test(navigator.userAgent)) { //判断Android
                //是android系统
                // alert("Android系统");
                jsAndroid.appPush(JSON.stringify(para))
            } else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
                //默认为iOS系统
                window.webkit.messageHandlers.appPush.postMessage(para);
            } else {
                //pc
                window.location.href = para.url;
                alert("PC浏览器");
            };
        }

猜你喜欢

转载自www.cnblogs.com/alone2015/p/9400504.html
今日推荐