给 button 加超链接 window.open 与 window.location.href 区别

😂 这篇文章最后更新于2107天前,您需要注意相关的内容是否还可用。

加超链接很简单,只需要在标签里添加点击事件:

onclick="window.open('/admin/goods_edit.html')"
或者
onclick="window.location.href='/admin/goods_edit.html'"

再抑或在外部加个 a 标签即可。

window.open 只是打开页面
window.location.href 打开页面并刷新