diff --git a/assets/styles/post.styl b/assets/styles/post.styl index a1b8101..ebb83d6 100644 --- a/assets/styles/post.styl +++ b/assets/styles/post.styl @@ -8,7 +8,7 @@ margin-y($top, $bottom = $top) padding 30px 60px font-size 14px line-height 1.8 - color #666 + color #282c33 font-weight 400 hyphens auto @@ -265,22 +265,12 @@ margin-y($top, $bottom = $top) & > :last-child margin-bottom 0 - .alert - .warning - .tip - font-size 13px + .veui-alert + p:first-child + margin-top 0 - .alert - border-color #fee - background-color tint(#fee, 50%) - - .warning - border-color #fef4e6 - background-color tint(#fef4e6, 50%) - - .tip - border-color #d8ebff - background-color tint(#d8ebff, 50%) + p:last-child + margin-bottom 0 .badges border none diff --git a/one/build/page.js b/one/build/page.js index a616e6e..4843a7f 100644 --- a/one/build/page.js +++ b/one/build/page.js @@ -59,7 +59,7 @@ export function renderDocToPage (file) { let src = resolve(DOCS_DIR, file) let dest = resolve(PAGES_DIR, replaceExtSync(file, 'vue')) let { contents, data } = renderFile(src, dest) - let { demos = {}, components = {}, meta = {}, deps = {} } = data + let { demos = {}, components = {}, meta = {}, deps = {}, hasAlert = false } = data Object.keys(deps || {}).forEach(dep => { add({ [dep]: { [src]: true } }) @@ -77,7 +77,8 @@ export function renderDocToPage (file) { } }), components: componentList, - boilerplate: demoList.length || componentList.length, + alert: hasAlert, + boilerplate: demoList.length || componentList.length || hasAlert, layout, style: style || 'post' }) diff --git a/one/build/remark-custom.js b/one/build/remark-custom.js index bde51d3..b728fdc 100644 --- a/one/build/remark-custom.js +++ b/one/build/remark-custom.js @@ -4,6 +4,11 @@ import { render } from './page' const NAME = 'customblock' +const typeMap = { + tip: 'info', + warning: 'warning' +} + export default function attacher () { let proto = this.Parser.prototype @@ -16,15 +21,25 @@ export default function attacher () { methods.unshift(NAME) return (tree, file) => { - let { path } = file + let { path, data } = file visit(tree, NAME, ({ className, value }, index, parent) => { let { contents } = render(value, path, {}) - className = className ? `${className} custom-block` : 'custom-block' - parent.children.splice(index, 1, { - type: 'html', - value: `
${contents}
` - }) + if (typeMap[className]) { + if (!data.hasAlert) { + data.hasAlert = true + } + parent.children.splice(index, 1, { + type: 'html', + value: `${contents}` + }) + } else { + className = className ? `${className} custom-block` : 'custom-block' + parent.children.splice(index, 1, { + type: 'html', + value: `
${contents}
` + }) + } }) } } diff --git a/one/docs/demo/directives/drag/sort-x.vue b/one/docs/demo/directives/drag/sort-x.vue index 62e50d0..2d90c7d 100644 --- a/one/docs/demo/directives/drag/sort-x.vue +++ b/one/docs/demo/directives/drag/sort-x.vue @@ -1,28 +1,24 @@ @@ -30,25 +26,7 @@ - - diff --git a/one/docs/demo/directives/drag/sort-y.vue b/one/docs/demo/directives/drag/sort-y.vue index 6f9afd5..56fb7c5 100644 --- a/one/docs/demo/directives/drag/sort-y.vue +++ b/one/docs/demo/directives/drag/sort-y.vue @@ -1,50 +1,31 @@ - - diff --git a/one/docs/demo/directives/tooltip.vue b/one/docs/demo/directives/tooltip.vue new file mode 100644 index 0000000..bc431ad --- /dev/null +++ b/one/docs/demo/directives/tooltip.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/one/docs/directives/v-drag.md b/one/docs/directives/v-drag.md index aab5b9a..8dbf575 100644 --- a/one/docs/directives/v-drag.md +++ b/one/docs/directives/v-drag.md @@ -6,27 +6,27 @@ ## 示例 -拖动元素。 +### 拖动元素 [[ demo src="/demo/directives/drag/base.vue" ]] -在指定元素区域内拖动。 +### 在指定元素区域内拖动 [[ demo src="/demo/directives/drag/containment.vue" ]] -拖动多个元素。 +### 拖动多个元素 [[ demo src="/demo/directives/drag/targets.vue" ]] -限制拖动方向。 +### 限制拖动方向。 [[ demo src="/demo/directives/drag/axis.vue" ]] -水平排序。 +### 水平排序 [[ demo src="/demo/directives/drag/sort-x.vue" ]] -垂直排序。 +### 垂直排序 [[ demo src="/demo/directives/drag/sort-y.vue" ]] diff --git a/one/docs/directives/v-tooltip.md b/one/docs/directives/v-tooltip.md index 2b29fe8..bce044f 100644 --- a/one/docs/directives/v-tooltip.md +++ b/one/docs/directives/v-tooltip.md @@ -10,6 +10,8 @@ VEUI 对通过 `v-tooltip` 定义的全局浮层提示进行了统一的体验 ## 示例 +[[ demo src="/demo/directives/tooltip.vue" ]] + ## API :::tip diff --git a/one/templates/page.etpl b/one/templates/page.etpl index 54c5177..1d834e1 100644 --- a/one/templates/page.etpl +++ b/one/templates/page.etpl @@ -6,14 +6,16 @@ ${content | raw} import { htmlAttrs } from '~/common/i18n' import ${component} from '~/components/${component}' import Demo${index} from '${demo.src}' -import OneDemo from '~/components/OneDemo' +import OneDemo from '~/components/OneDemo' +import { VeuiAlert } from 'veui' export default { mixins: [htmlAttrs], components: { ${component}, '${demo.name}': Demo${index}, - OneDemo + OneDemo, + VeuiAlert } }