vue项⽬样式动态渲染_渲染样式
vue项⽬ 样式动态渲染
The question is - what will a browser do, given a page with several stylesheets, each of them probably overwriting definitions from the previous ones? Will the browser render the page using the first received css file, while downloading the other ones and after that partially re-rendering where required? The answer is: no, the browser will wait until all CSS files are downloaded, (then probably merge all definitions, just a wild guess) and will render once.
问题是-给定⼀个页⾯包含多个样式表的情况下,浏览器将如何处理,每个样式表可能会覆盖先前样式表的定义? 浏览器是否会在下载其他⽂件时使⽤接收到的第⼀个CSS⽂件来渲染页⾯,然后在需要时部分重新渲染? 答案是:不会,浏览器将等到所有CSS⽂件下载完毕(然后可能会合并所有定义,只是⼀个疯狂的猜测),并将呈现⼀次。
测试 (Test)
I did this test - one page with two stylesheets that contain pretty much the same selectors for different table styles (thanks to ). Each of the CSS files is actually a PHP script and has a call to , one sleeps for 5 seconds, the other one for 10.
我进⾏了此测试-⼀页包含两个样式表,其中包含⼏乎相同的选择器,⽤于不同的表格样式(感谢 )。 每个CSS⽂件实际上都是⼀个PHP脚本,并调⽤了 ,⼀个睡眠5秒钟,另⼀个睡眠10秒钟。
结果 (Result)
The browser sits there and waits for the both styles, rendering nothing (except for the page title, but that's not really rendering, is it?). So nothing happens for 10 seconds, then the second style is used for the final rendering. This happens in both FF and IE.
浏览器坐在那⼉,等待这两种样式,什么都不呈现(页⾯标题除外,但这不是真正的呈现,是吗?)。 因此10秒钟没有任何React,然后将第⼆种样式⽤于最终渲染。 在FF和IE中都会发⽣这种情况。
css表格样式
杂项 (Misc)
I also tried sleeping in the actual page, and flushing the output after each row. In my home environment FF renders each
row as it's received, but in my hosted environment, it waits for the whole table. IE alsways waits for the complete table.
我还尝试在实际页⾯中Hibernate,并在每⼀⾏之后刷新输出。 在我的家庭环境中,FF会在接收到每⼀⾏时对其进⾏渲染,但是在我的托管环境中,它将等待整个表。 IE始终等待完整的表。
If I put the page to too much sleep so that the php script dies before the second stylesheet is dowloaded, the browser uses whatever is at hand (css1) to render the page.
如果我让页⾯睡得太多,以致php脚本在下载第⼆个样式表之前就死了,那么浏览器将使⽤⼿头的任何东西(css1)来呈现页⾯。
演⽰/下载 (Demo/download)
- two CSS files, first one sleeping 5 seconds, the other one 10
-两个CSS⽂件,第⼀个CSS睡眠5秒,另⼀个10
, sleeping 1 second after each row
每排睡⼀秒钟
, css sleeps 5 seconds
,css睡眠5秒
for your testing pleasure
为您带来测试乐趣
Tell your friends about this post on and 在和上告诉您的朋友有关此帖⼦的信息翻译⾃:
vue项⽬ 样式动态渲染

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。