vue

按需加载

2020-06-29  本文已影响0人  舍予Victoria

注意点: 通过 improt xxx from xxx的方式加载组件, 无论组件有没有被用到, 都会被加载进来

import Recommend from '../views/Recommend'

import Singer from '../views/Singer'

import Rank from '../views/Rank'

import Search from '../views/Search'

实现Vue组件的按需加载

```

test

```

```

const Recommend = (resolve) => {

  import('../views/Recommend').then((module) => {

    resolve(module)

  })

}

const Detail = (resolve) => {

  import('../views/Detail').then((module) => {

    resolve(module)

  })

}

```

上一篇下一篇

猜你喜欢

热点阅读