|
| 1 | +# Basic Configuration |
| 2 | + |
| 3 | +### Basic Information |
| 4 | + |
| 5 | +Page title and logo |
| 6 | + |
| 7 | +```ts |
| 8 | +export default defineConfig({ |
| 9 | + docs: { |
| 10 | + title: 'antmjs Doc', |
| 11 | + logo: 'xxxxx', |
| 12 | + }, |
| 13 | +}) |
| 14 | +``` |
| 15 | + |
| 16 | +### Document Source and Output |
| 17 | + |
| 18 | +The document source file path `src` is set to `./docs` by default, relative to the root directory where the command is executed. |
| 19 | + |
| 20 | +```ts |
| 21 | +export default defineConfig({ |
| 22 | + docs: { |
| 23 | + src: join(CWD, './docs'), |
| 24 | + output: 'doc_build', |
| 25 | + }, |
| 26 | +}) |
| 27 | +``` |
| 28 | + |
| 29 | +### Top Navigation Links |
| 30 | + |
| 31 | +Use `headerLinks` to set the top navigation of the page. |
| 32 | + |
| 33 | +- Regular icon navigation `type:image` |
| 34 | + |
| 35 | +```ts |
| 36 | +export default defineConfig({ |
| 37 | + docs: { |
| 38 | + headerLinks: [ |
| 39 | + { |
| 40 | + type: 'image', |
| 41 | + title: 'https://b.yzcdn.cn/vant/logo/github.svg', |
| 42 | + url: 'https://github.com', |
| 43 | + }, |
| 44 | + ], |
| 45 | + }, |
| 46 | +}) |
| 47 | +``` |
| 48 | + |
| 49 | +- Regular icon navigation `type:text` |
| 50 | + |
| 51 | +```ts |
| 52 | +export default defineConfig({ |
| 53 | + docs: { |
| 54 | + headerLinks: [ |
| 55 | + { |
| 56 | + type: 'text', |
| 57 | + title: 'github', |
| 58 | + url: 'https://github.com', |
| 59 | + }, |
| 60 | + ], |
| 61 | + }, |
| 62 | +}) |
| 63 | +``` |
| 64 | + |
| 65 | +- Regular icon navigation `type:select` |
| 66 | + |
| 67 | +```ts |
| 68 | +export default defineConfig({ |
| 69 | + docs: { |
| 70 | + headerLinks: [ |
| 71 | + { |
| 72 | + type: 'select', |
| 73 | + title: 'More', |
| 74 | + options: [ |
| 75 | + { |
| 76 | + title: 'antmjs', |
| 77 | + github: 'https://github.com/AntmJS/antm', |
| 78 | + }, |
| 79 | + ], |
| 80 | + }, |
| 81 | + ], |
| 82 | + }, |
| 83 | +}) |
| 84 | +``` |
| 85 | + |
| 86 | +### Menu Configuration |
| 87 | + |
| 88 | +The menu currently only supports two-level menus. Due to `require cache`, the menu configuration is stored separately, which may not support hot updates. |
| 89 | + |
| 90 | +```ts |
| 91 | +import type { IMenuNavs } from '@antmjs/types' |
| 92 | + |
| 93 | +const menu: IMenuNavs = [ |
| 94 | + { |
| 95 | + name: 'User Guide', |
| 96 | + items: [ |
| 97 | + { |
| 98 | + title: 'Introduction', |
| 99 | + path: 'introduce', |
| 100 | + }, |
| 101 | + ], |
| 102 | + }, |
| 103 | +] |
| 104 | + |
| 105 | +export default defineConfig({ |
| 106 | + docs: { |
| 107 | + menu: menu, |
| 108 | + }, |
| 109 | +}) |
| 110 | +``` |
| 111 | + |
| 112 | +### Mobile Display |
| 113 | + |
| 114 | +The main configuration is as follows: |
| 115 | + |
| 116 | +- `url`: divided into development and production environments |
| 117 | +- `noMate`: set redirection when there is no mapping relationship for the URL |
| 118 | +- `transform`: define mapping rules |
| 119 | + |
| 120 | +```ts |
| 121 | +export default defineConfig({ |
| 122 | + docs: { |
| 123 | + simulator: { |
| 124 | + url: { |
| 125 | + development: 'http://10.254.9.214:10086', |
| 126 | + production: '/vantui/main/mobile.html', |
| 127 | + }, |
| 128 | + transform: (url) => `#/pages/${url}/index`, |
| 129 | + noMate: { |
| 130 | + urls: [ |
| 131 | + 'quickstart', |
| 132 | + 'custom-style', |
| 133 | + 'home', |
| 134 | + 'theme', |
| 135 | + 'use-in-react', |
| 136 | + 'contributing', |
| 137 | + 'v2-to-v3', |
| 138 | + 'comments', |
| 139 | + 'premium', |
| 140 | + ], |
| 141 | + redirect: '#/pages/dashboard/index', |
| 142 | + }, |
| 143 | + }, |
| 144 | + }, |
| 145 | +}) |
| 146 | +``` |
0 commit comments