手机端跳转页面指定楼层

<button id="btn">跳转</button>

<script>
function urlParse (queryStr) {
        let arr = queryStr.slice(1).split('&');
        let map = {};
        arr.forEach(item => {
          let param = item.split('=');
          map[param[0]] = param[1];
        });
        return map;
      }
if (urlParse(window.location.search).app === "app") {
    // app 写这里
        var oBtn = document.getElementById('btn')
    oBtn.addEventListener("click",function(){
        window.location.href = 'mix_20190523_fuzhuang#component_6290831';
    });

} else {
        // H5 写这里
       var oBtn = document.getElementById('btn')
    oBtn.addEventListener("click",function(){
        window.location.href = 'http://h5.dangdang.com/mix_20190523_fuzhuang#component_6290831';
    });
}

</script>

posted @ 2019-05-30 14:00  硕果累累~  阅读(357)  评论(0编辑  收藏  举报