代码如下,我想对路由进行懒加载,但是能够进行正在加载中的提示,按照官网提示,但是delay没有效果
路由加载:
{
path: '/Me', name: 'Me', //component: r => import("@/views/loading/loadable") component: asyncComponent() }
asyncComponent函数:
import LoadingComponent from '@/views/loading/index.vue'
import errorCom from '@/views/loading/error'
export default (asyncComponent) => {
const Com= function(){ let a = { component: require('@/views/Me'), loading: LoadingComponent, error: errorCom, delay: 2000 } return a }return { render: function (h) { return h(Com, {}) } }
}
www说