-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attr({})方法当去掉一个样式时无效 #3758
Comments
设置了overwrite:true也没有效果 |
可以通过设置 |
好吧,因为我这边visibility这个属性是用户在我编辑器界面动态添加的样式,当数据为用户设置的某个值时就会添加上这个样式,不是某值时就还原为初始状态,所以只是两个对象互换,如果是这样那我就只能对比这两个对象的差异然后手动移除多出来的样式了,这个以后会考虑修改吗? |
奇怪了,我想直接用removeAttrs移除所有样式,然后在setAttrs添加所有样式居然页面也没有变化。 |
调用removeAttrByPath直接删除指定样式倒是起作用的 |
@hhzhldhjl 这个属性如果是用户自己来设置的话,我理解使用 switch 或者 checkbox 更用户友好,提供两个选项:visible 和 hidden。 |
我这个地方是根据data的变化在原始态和用户修改样式后的状态来回切换,只是removeAttrs这个方法应该移除所有样式后页面会重新根据没有attr的形式来重绘才对吧?我这个没有重绘,是我写的问题还是我理解错这个方法了呢 |
如果不是特殊需求不要使用 removeAttrs,因为它同时会清除所有内置的 attrs,你无法在外面通过 setAttrs 恢复的。 |
好吧,那只能这样了 |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
问题描述
我改变前的attr是{water:{fill:"#37cfe7","visibility: "hidden"}}后来调用attr({water:{fill:"#37cfe7"}})设置,但是visibility这个属性在对象中去掉了,但是画面并没有更新为显示状态
重现链接
无
重现步骤
开始attr为
{
water:{
fill:"#37cfe7",
"visibility: "hidden"
}
}
调用attr设置后节点应该转为显示状态
cell.attr({
water:{
fill:"#37cfe7"
}
})
预期行为
visibility样式去掉后更新后页面中节点应该转为显示状态
平台
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: