谷歌浏览器中默认鼠标移入 a 标签时,左下角会显示路由地址,如下图:
在vue项目中的解决方法为:
//去掉浏览器左下角的URL
deleteMsg(){
$("body").on('mouseover', 'a', function (e) {
let $link = $(this)
let href = $link.attr('href') || $link.data("href");
// console.log($link, href)
$link.off('click.chrome');
$link.on('click.chrome', function() {
window.location.href = href;
})
.attr('data-href', href)
.css({ cursor: 'pointer' })
.removeAttr('href');
})
}
此方法的含义为