angular.js - vue/react 渲染内容抖动
滿天的星座
滿天的星座 2017-05-15 17:06:43
0
3
655

vue/react/angular框架等 渲染数据时,页面产生抖动,给用户一种不太友好的感觉,怎样消除这种抖动呢?

滿天的星座
滿天的星座

reply all(3)
巴扎黑

The first method is to place a loading prompt in the rendered area in advance, hide/delete the loading after rendering, and display normal content.

The second method is to give the data an initial value, which can support the page style, and then replace it after obtaining it.

The transformation of the second method starts from CSS, so that the unrendered part can be displayed and the structure is consistent with that after rendering. After rendering is completed, only the corresponding data is changed, and the page structure is not changed.

迷茫

Using ng-cloakv-cloak, I have never been exposed to React so I don’t know.

漂亮男人

In addition to the solution in the first answer, you can also consider isomorphism. Reactjs provides such a solution. The output of nodejs is the formed page. There is no need for the client to rerender once, and there is no problem of flashing.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!