Vue.js编译速度慢

时间:2017-11-14 06:54:48

标签: performance compilation vue.js

NSString *date = [sortedDates objectAtIndex:section-1]; 执行得非常快。

当我向.vue文件(模板)添加1000行html(标题)时,编译需要9分钟。

问题:

vue.js不支持这么冗长的模板吗?

有没有办法加快速度?

npm run dev

2 个答案:

答案 0 :(得分:1)

因为您正在使用具有静态1000 html元素的静态模板。使用 v-for
它将做的只是编译(而不是运行!)hash_with_values = hash.keys.zip(values).to_h 上的Vue语法 也请查看此内容:One Useful Link on Rows Rendering on Different Frameworks

答案 1 :(得分:0)

这是由于漂亮的夹板所致。

解决方案

请按照以下步骤进行修复。

  1. 转到/node_modules/vue-loader/lib/template-compiler/index.js行78:81

  2. 更改

    if(!isProduction){

    code = prettier.format(code,{semi:false})

    }

    //如果(!isProduction){

    // code = prettier.format(code,{semi:false})

    //}