vue中hash模式下锚点多页面跳转

1.目标页面设置锚点及跳转事件

            <p id="demoAnchor">直播时间:2021年10月20日</p>

methods:{

open(){

          window.location.href = '#demoAnchor';

          }

  },

mounted(){

    if(this.$route.query.active){

      this.open();

}

2.准备跳转页面,设置跳转,传过去一个参数

      <router-link to="/activity?active=demoAnchor" class="rules">比赛规则</router-link>


 

上一篇:js模拟页面点击事件下载图片


下一篇:vue刷新会跳转首页怎么解决?原因之一