Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

a标签可以不压栈吗,类似于loacation.replace()

页面中用了<a></a>标签跳转,但是不想生成历史记录,希望用户点击回退按钮时,不会跳转回这个页面,类似于location.replace()的作用。请问有办法吗?

补充:因为href还是动态绑定的,如果在href中加入javascript的代码编辑器会报'v-bind' directives require an attribute value.的错。

<div class="filtrate-wrap">
      <a :href="javascript:location.replace('selector.html?title=地区&page=xkResult1&filter=' + JSON.stringify(filter))" class='filtrate-item'>
        {{ filter.province === '所有' ? '地区' : filter.province }}
      </a>
        <a :href="'selector.html?title=类型&page=xkResult1&filter=' + JSON.stringify(filter)" class='filtrate-item'>
          {{ filter.type === '所有' ? '类型' : filter.type }}
        </a>
        <a :href="'selector.html?title=层次&page=xkResult1&filter=' + JSON.stringify(filter)" class='filtrate-item'>
          {{ filter.level === '所有' ? '层次' : filter.level }}
        </a>
      </div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

href="javascript:location.replace('url')"这样是可以,但好像并不是题主想要的,以我的了解是没有的,看会不会被打脸吧


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...