docs: 整理文档

This commit is contained in:
就眠仪式 2021-10-23 15:54:37 +08:00
parent 9a6244dfe8
commit e60147b58e
13 changed files with 56 additions and 56 deletions

View File

@ -1,3 +1,6 @@
::: field 基础使用
:::
::: demo ::: demo
<template> <template>

View File

@ -1,3 +1,6 @@
::: field 主色调
:::
::: demo ::: demo
<template> <template>
@ -43,6 +46,9 @@ export default {
::: :::
::: field 次色调
:::
::: demo ::: demo
<template> <template>
@ -88,6 +94,9 @@ export default {
::: :::
::: field 中性色
:::
::: demo ::: demo
<template> <template>

View File

@ -6,7 +6,6 @@ function assignScript(script: string) {
const dependencies = {} as Record<string, string[]> const dependencies = {} as Record<string, string[]>
const attrs = {} as Record<string, string> const attrs = {} as Record<string, string>
const content = script const content = script
// import { ref } from 'vue' -> ''
.replace(/import\s?\{.*\}.*/g, (item) => { .replace(/import\s?\{.*\}.*/g, (item) => {
const key = getInnerString(item.replace(/'/g, '"'), '"', '"') const key = getInnerString(item.replace(/'/g, '"'), '"', '"')
const value = getInnerString(item.replace(/\s+/g, ''), '{', '}') const value = getInnerString(item.replace(/\s+/g, ''), '{', '}')

View File

@ -1,9 +1,7 @@
// copy from [vitepress](https://github.com/vuejs/vitepress)
import prism from 'prismjs' import prism from 'prismjs'
import loadLanguages from 'prismjs/components/index' import loadLanguages from 'prismjs/components/index'
import escapeHtml from 'escape-html' import escapeHtml from 'escape-html'
// required to make embedded highlighting work...
loadLanguages(['markup', 'css', 'javascript']) loadLanguages(['markup', 'css', 'javascript'])
function wrap(code: string, lang: string): string { function wrap(code: string, lang: string): string {

View File

@ -7,21 +7,16 @@ export default (md: MarkdownIt): void => {
const CH = '<'.charCodeAt(0) const CH = '<'.charCodeAt(0)
const pos = state.bMarks[startLine] + state.tShift[startLine] const pos = state.bMarks[startLine] + state.tShift[startLine]
const max = state.eMarks[startLine] const max = state.eMarks[startLine]
// if it's indented more than 3 spaces, it should be a code block
if (state.sCount[startLine] - state.blkIndent >= 4) { if (state.sCount[startLine] - state.blkIndent >= 4) {
return false return false
} }
for (let i = 0; i < 3; ++i) { for (let i = 0; i < 3; ++i) {
const ch = state.src.charCodeAt(pos + i) const ch = state.src.charCodeAt(pos + i)
if (ch !== CH || pos + i >= max) return false if (ch !== CH || pos + i >= max) return false
} }
if (silent) { if (silent) {
return true return true
} }
const start = pos + 3 const start = pos + 3
const end = state.skipSpacesBack(max, pos) const end = state.skipSpacesBack(max, pos)
const rawPath = state.src const rawPath = state.src
@ -32,17 +27,13 @@ export default (md: MarkdownIt): void => {
? fs.readFileSync(rawPath).toString() ? fs.readFileSync(rawPath).toString()
: 'Not found: ' + rawPath : 'Not found: ' + rawPath
const meta = rawPath.replace(rawPath, '') const meta = rawPath.replace(rawPath, '')
state.line = startLine + 1 state.line = startLine + 1
const token = state.push('fence', 'code', 0) const token = state.push('fence', 'code', 0)
token.info = rawPath.split('.').pop() + meta token.info = rawPath.split('.').pop() + meta
token.content = content token.content = content
token.markup = '```' token.markup = '```'
token.map = [startLine, startLine + 1] token.map = [startLine, startLine + 1]
return true return true
} }
md.block.ruler.before('fence', 'snippet', parser) md.block.ruler.before('fence', 'snippet', parser)
} }

View File

@ -246,6 +246,6 @@ const zhCN = [
}, },
], ],
}, },
] ];
export default zhCN export default zhCN

View File

@ -1,4 +1,3 @@
/* copy from [vitepress](https://github.com/vuejs/vitepress) */
code { code {
margin: 0; margin: 0;
border-radius: 3px; border-radius: 3px;

View File

@ -1,6 +1,6 @@
<template> <template>
<lay-side> <lay-side>
<ul class="layui-menu layui-menu-lg layui-menu-docs" style="padding: 8px"> <ul class="layui-menu layui-menu-lg layui-menu-docs">
<li <li
v-for="menu in menus" v-for="menu in menus"
:key="menu" :key="menu"
@ -145,7 +145,8 @@ export default {
title: '选项卡', title: '选项卡',
subTitle: 'tab', subTitle: 'tab',
path: '/zh-CN/components/tab', path: '/zh-CN/components/tab',
}, { },
{
id: 27, id: 27,
title: '下拉菜单', title: '下拉菜单',
subTitle: 'dropdown', subTitle: 'dropdown',
@ -153,36 +154,6 @@ export default {
}, },
], ],
}, },
{
id: 1,
title: '辅助',
children: [
{
id: 13,
title: '徽章',
subTitle: 'badge',
path: '/zh-CN/components/badge',
},
{
id: 14,
title: '区块',
subTitle: 'block',
path: '/zh-CN/components/block',
},
{
id: 15,
title: '分割',
subTitle: 'line',
path: '/zh-CN/components/line',
},
{
id: 24,
title: '字段',
subTitle: 'field',
path: '/zh-CN/components/field',
},
],
},
{ {
id: 1, id: 1,
title: '表单', title: '表单',
@ -321,6 +292,36 @@ export default {
}, },
], ],
}, },
{
id: 1,
title: '辅助',
children: [
{
id: 13,
title: '徽章',
subTitle: 'badge',
path: '/zh-CN/components/badge',
},
{
id: 14,
title: '区块',
subTitle: 'block',
path: '/zh-CN/components/block',
},
{
id: 15,
title: '分割',
subTitle: 'line',
path: '/zh-CN/components/line',
},
{
id: 24,
title: '字段',
subTitle: 'field',
path: '/zh-CN/components/field',
},
],
},
] ]
const selected = ref(1) const selected = ref(1)

View File

@ -1,6 +1,6 @@
<template> <template>
<lay-side> <lay-side>
<ul class="layui-menu layui-menu-lg layui-menu-docs" style="padding: 8px"> <ul class="layui-menu layui-menu-lg layui-menu-docs">
<li <li
v-for="menu in menus" v-for="menu in menus"
:key="menu" :key="menu"
@ -81,7 +81,7 @@ export default {
path: '/zh-CN/guide/changelog', path: '/zh-CN/guide/changelog',
}, },
], ],
} },
] ]
const selected = ref(1) const selected = ref(1)

View File

@ -126,7 +126,7 @@
height: 100%; height: 100%;
} }
.site-download { .site-download {
margin-top: 80px; margin-top: 72px;
font-size: 0; font-size: 0;
} }
.site-download a { .site-download a {