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

IE7加载性能问题 #199

Open
BigFrontEnd-China opened this issue Dec 8, 2017 · 9 comments
Open

IE7加载性能问题 #199

BigFrontEnd-China opened this issue Dec 8, 2017 · 9 comments

Comments

@BigFrontEnd-China
Copy link

BigFrontEnd-China commented Dec 8, 2017

目前我们有一个项目完全使用您的这个框架构建的。所有的组件也都使用regular来完成。整个页面的结构是做一个regular对象来处理的。页面里面又包含了很多小的regular组件,同时还有很多的逻辑处理({if})和遍历({list})。当然我们在list的时候也使用了by item_index。在IE7加载的过程中速度很慢,其它浏览器无加载问题。请问下您这边有什么好的优化建议么?

@leeluolee
Copy link
Member

leeluolee commented Dec 8, 2017

@China-Boy-1985 一般是列表问题 list 看下能否 使用 list items as item by item_index 语句

嵌套组件 看能否使用 isolate 进行隔离

<component isolate title={title} /> 不再与上层双向绑定 <component isolate=1 title={title}> 代表是从父到子是单向数据流动(类似React

@China-Boy-1985

@BigFrontEnd-China
Copy link
Author

目前这边主要是需要兼容IE7,而您的这个框架的兼容性目前也是很吻合的。就以上所说的优化方式除外还有其它方式么?

@leeluolee
Copy link
Member

@China-Boy-1985 可以看下页面么?

@BigFrontEnd-China
Copy link
Author

  <div id="container"></div>
  <script type="template/regular">
    <form action="">
      <div class="group-container">
        {if x === 1}
          <div class="form-group">
            <rg-xx></rg-xx>
          </div>
        {/if}
        {if a === 1}
          <div class="form-group">
            <rg-aa></rg-aa>
          </div>
        {/if}
        {if b === 1}
          <div class="form-group">
            <rg-bb></rg-bb>
          </div>
        {/if}
        {if c === 1}
          <div class="form-group">
            <rg-cc></rg-cc>
          </div>
        {/if}
        {list}
          <div>
            代码块
            {list}
            <div>代码块</div>
            {/list}
          </div>
        {/list}
      </div>
    </form>
  </script>

@BigFrontEnd-China
Copy link
Author

代码结构大致是上面这样的,然后inject到container。regular实例里面还有很多逻辑处理。整个页面require的js大概有10几个吧,这边使用的requireJS。在IE7中效率非常的慢。

@leeluolee
Copy link
Member

@China-Boy-1985 requirejs 的文件有打包么? 还是都是异步加载的

@BigFrontEnd-China
Copy link
Author

使用gulp打包的,只是没合并而已。使用的require([], function() {})这种方式加载。应该全部是异步加载的。

@leeluolee
Copy link
Member

@China-Boy-1985 建议先打包后, 再排查对应Regular性能问题。 排除requirejs本身的问题噪音

@gongph
Copy link

gongph commented Apr 16, 2018

@China-Boy-1985 然后呢? 后来如何解决的?

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

No branches or pull requests

4 participants