Skip to content
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

该插件在一些需要渲染获取的data的情境下行为不符合预期 #5

Open
songzhi opened this issue Feb 7, 2018 · 0 comments

Comments

@songzhi
Copy link

songzhi commented Feb 7, 2018

当组件从服务器获取数据之后,有可能会自己操作DOM渲染。但是这个插件的实现是直接把获取的数据插入DOM中。而这些组件无法重新渲染,因为往往是渲染之后该插件又改变了DOM,所以就会显示数据本身。

这在使用一些第三方组件的时候很常见,比如我以自定义指令的方式封装了highlight.js,如果同时使用这两个指令,就会出现hljs已经把代码块渲染好了高亮了,而该插件又重新将DOM改变成了原始的数据,所以高亮又消失了。这个问题我的解决办法是,因为你的源码里写了timeout,是300ms,我也将代码高亮的操作设置了timeout,400ms。完美解决。

但是对于我是用的其他的组件,由于是第三方的,所以我不可能修改源码,所以就只能在这个组件上弃用这个插件。

我的想法是,可不可以将插入data,改为插入data更新后的DOM,因为也有可能有其他组件在渲染DOM,而不是插入原始的data。

由于我的前端水平太低,所以不能提Pull request,只能开个Issue供您参考。希望您能解决这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant