39,087
社区成员
发帖
与我相关
我的任务
分享
加事件?
var obj = document.getElementById("fy");
//obj.attachEvent('onfocus', add); //在原先事件上添加
//obj.setAttribute('onfocus',add); //会替代原有事件方法
//obj.onfocus=add; //等效obj.setAttribute('onfocus',add);
if(window.addEventListener)
{
//其它浏览器的事件代码: Mozilla, Netscape, Firefox
//添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件,不用加on
obj.addEventListener('focus', add, false);
}
else
{
//IE 的事件代码 在原先事件上添加 add 方法
obj.attachEvent('onfocus',add);
}
[/quote]
其实可以用jQuery实现的,只是不敢说,怕被喷。想问问用vue有啥方便的方法没。
结果还是被一个技术群踢出去了,群主说我不爱专研,不适合做前端,哎。
this.$nextTick(() => {
//渲染完毕后调用,先用简单的方式实现。
var dom = $("#blogArticle").find("p,ul");
dom.unbind();
dom.click(function () {
//做快速回复
discussForm.isShow = true;
discussForm.discuss.ArticleId = currentArticleInfo.ArticleId = id;
discussForm.discuss.Chapter = currentArticleInfo.Chapter = this.innerText;
});
});
var obj = document.getElementById("fy");
//obj.attachEvent('onfocus', add); //在原先事件上添加
//obj.setAttribute('onfocus',add); //会替代原有事件方法
//obj.onfocus=add; //等效obj.setAttribute('onfocus',add);
if(window.addEventListener)
{
//其它浏览器的事件代码: Mozilla, Netscape, Firefox
//添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件,不用加on
obj.addEventListener('focus', add, false);
}
else
{
//IE 的事件代码 在原先事件上添加 add 方法
obj.attachEvent('onfocus',add);
}