异步按需加载组件

解读

一切,都要从性能开始说起,来不及解释了,快上车!!!

// 路由异步加载组件
const Foo = () => import("./Foo.vue");
// 组件异步加载,就是说,当我们用到组件的时候再加载
new Vue({
  // ...
  components: {
    "my-component": () => import("./my-async-component"),
  },
});
1
2
3
4
5
6
7
8
9
Last Updated:
Contributors: websong