mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-21 01:13:16 +08:00
site: only show debug anchor in debug mode
This commit is contained in:
parent
491351ff88
commit
7226568f80
@ -21,10 +21,8 @@ async function resolveDemoInfos (literal, url, env) {
|
||||
.filter((id) => id.length)
|
||||
const infos = []
|
||||
for (const id of ids) {
|
||||
if (
|
||||
env === 'production' &&
|
||||
(id.includes('debug') || id.includes('Debug'))
|
||||
) {
|
||||
const debug = id.includes('debug') || id.includes('Debug')
|
||||
if (env === 'production' && debug) {
|
||||
continue
|
||||
}
|
||||
const fileName = `${id}.demo.md`
|
||||
@ -34,7 +32,8 @@ async function resolveDemoInfos (literal, url, env) {
|
||||
variable,
|
||||
fileName,
|
||||
title: await resolveDemoTitle(fileName, url),
|
||||
tag: `<${variable} />`
|
||||
tag: `<${variable} />`,
|
||||
debug
|
||||
})
|
||||
}
|
||||
return infos
|
||||
@ -52,8 +51,8 @@ function genAnchorTemplate (children, options = {}) {
|
||||
|
||||
function genDemosAnchorTemplate (demoInfos) {
|
||||
const links = demoInfos.map(
|
||||
({ id, title }) => `<n-anchor-link
|
||||
v-if="true"
|
||||
({ id, title, debug }) => `<n-anchor-link
|
||||
v-if="(displayMode === 'debug') || ${!debug}"
|
||||
title="${title}"
|
||||
href="#${id}"
|
||||
/>`
|
||||
@ -90,6 +89,7 @@ function genScript (demoInfos, components = [], url, forceShowAnchor) {
|
||||
${importStmts}
|
||||
import { computed } from 'vue'
|
||||
import { useBreakpoint, useMemo } from 'vooks'
|
||||
import { useDisplayMode } from '/demo/store'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -109,6 +109,7 @@ export default {
|
||||
})
|
||||
return {
|
||||
showAnchor: showAnchorRef,
|
||||
displayMode: useDisplayMode(),
|
||||
wrapperStyle: computed(() => {
|
||||
return !useSmallPaddingRef.value
|
||||
? 'display: flex; flex-wrap: nowrap; padding: 32px 24px 24px 56px;'
|
||||
|
@ -286,9 +286,7 @@ Debug 用的。
|
||||
<n-button text type="warning">Warning</n-button>
|
||||
<n-button text type="error" icon-placement="right">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<n-icon><cash-outline /></n-icon>
|
||||
</n-icon>
|
||||
<n-icon><cash-outline /></n-icon>
|
||||
</template>
|
||||
Error
|
||||
</n-button>
|
||||
|
6
vue3.md
6
vue3.md
@ -462,10 +462,10 @@
|
||||
- [x] anchor ignore gap 有 bug
|
||||
- [x] popover click 移动端不生效
|
||||
- [ ] menu path 对应的问题
|
||||
- [ ] debug anchor 删除无用 link
|
||||
- [x] debug anchor 删除无用 link
|
||||
- [ ] popover inst methods
|
||||
- [ ] ios 浏览器 demo code font size 不对
|
||||
- [ ] table overflow bordered
|
||||
- [x] ios 浏览器 demo code font size 不对
|
||||
- [ ] <del>table overflow bordered</del>
|
||||
|
||||
## Build
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user