注意点: 通过 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)
})
}
```
网友评论