2024年6月


coloruiBeta (uni-app版)
github:https://github.com/Color-UI/coloruiBeta
gitee:https://gitee.com/color-ui/coloruiBeta
演示效果:https://cu-h5.vercel.app/

MP-CU(微信小程序原生版)
github:https://github.com/Color-UI/MP-CU
gitee:https://gitee.com/color-ui/MP-CU
文档地址:https://mp-cu-doc-vercel.vercel.app/

静态资源包
github:https://github.com/Color-UI/assest
gitee:https://gitee.com/color-ui/assest
在线引用:https://colorui-assest.vercel.app/ + 资源路径

在 src下的目录结构

QQ20240531-081042@2x.png

在 router下的路由实现

import { createRouter, createWebHistory } from 'vue-router'

// const routes = [
//     {
//         path: '/',
//         component: () => import('/pages/views/index/index.vue'),
//     },
//     {
//         path: '/about',
//         component: () => import('/pages/views/about/index.vue'),
//     }
// ]

const pageModules = import.meta.glob('../views/**/page.js', {
    eager: true,
    import: 'default'
});

const pageComps = import.meta.glob('../views/**/index.vue',{
    eager: true,
    import: 'default'
});

const routes =Object.entries(pageModules).map(([pagePath, config])=> {
    console.log(pagePath, config);
    let path = pagePath.replace('../views', '').replace('/page.js', '');
    path = path || '/';
    const name = path.split('/').filter(Boolean).join('-') || 'index';
    const compPath = pagePath.replace('page.js', 'index.vue');
    return {
        path,
        name,
        component: pageComps[compPath],
        meta: config,
    };
});

console.log(routes)


const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router