1.0.4 • Published 4 years ago

route-merge v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago
/* 
    1、根属性名为root,如果要自定义,请传第2个参数,具体看下边
    2、如root路径是/开头,则表示绝对路径,不拼接父级路径
        否则当成相对路径

    3、函数第2个参数为根属性名,默认为root
        如果自定义,请传第2个参数:字符串
    如:
    config={
        myRoot: '/',
        admin: {
            myRoot: 'admin-page',
            content: 'content'
        }
    }
    rm(config, 'myRoot')
     */
import rm from 'route-merge'
const config = {
    
    root: '/',//根路径值换成abc也可以...如:root: 'abc', login:abc/login
    login: 'login-page',
    admin: {
        root: 'admin-page',
        content1: 'content1',
        content2: {
            root: '/content2',
            content2_1: 'content2_1'
        }
    },
    error: 'error'
}
const result = rm(config);
/*
{
  login: '/login-page',
  admin: '/admin-page',
  content1: '/admin-page/content1',
  content2: '/content2',
  content2_1: '/content2/content2_1',
  error: '/error'
}
*/
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago