美文网首页vue
按需加载

按需加载

作者: 舍予Victoria | 来源:发表于2020-06-29 15:40 被阅读0次

    注意点: 通过 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)

      })

    }

    ```

    相关文章

      网友评论

        本文标题:按需加载

        本文链接:https://www.haomeiwen.com/subject/acoofktx.html