-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
69 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineComponent, h } from 'vue'; | ||
import { NImage } from './naive'; | ||
import { convertSrc } from '../utils/img'; | ||
|
||
const GImg = defineComponent<{ | ||
src: string; | ||
width?: number | string; | ||
}>( | ||
(props) => { | ||
return () => { | ||
return h(NImage, { | ||
src: convertSrc(props.src), | ||
width: props.width, | ||
}); | ||
}; | ||
}, | ||
{ | ||
props: ['src', 'width'], | ||
}, | ||
); | ||
|
||
export default GImg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import naiveComponents from './naive'; | ||
import GImg from './GImg'; | ||
import ImageTable from './ImageTable.vue'; | ||
import IdentifierField from './IdentifierField.vue'; | ||
import ApkDownloadButton from './ApkDownloadButton.vue'; | ||
|
||
export default { | ||
...naiveComponents, | ||
GImg, | ||
ImageTable, | ||
IdentifierField, | ||
ApkDownloadButton | ||
}; |
21 changes: 16 additions & 5 deletions
21
docs/.vitepress/utils/naive.ts → docs/.vitepress/components/naive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
import { defineComponent,h } from 'vue'; | ||
import { DefaultSlotCpt, defineVitePressAsyncComponent } from './async'; | ||
import { defineComponent, h } from 'vue'; | ||
import { DefaultSlotCpt, defineVitePressAsyncComponent } from '../utils/async'; | ||
|
||
const ImgCpt = defineComponent( | ||
const FakeNImage = defineComponent( | ||
(props, ctx) => { | ||
return () => { | ||
return h('img', { ...ctx.attrs, ...props }); | ||
return h( | ||
'div', | ||
{ class: 'n-image' }, | ||
h('img', { ...ctx.attrs, ...props }), | ||
); | ||
}; | ||
}, | ||
{ props: ['src'] }, | ||
); | ||
|
||
export const NImage = defineVitePressAsyncComponent({ | ||
loader: () => import('naive-ui/es/image').then((m) => m.NImage), | ||
loadingComponent: ImgCpt, | ||
loadingComponent: FakeNImage, | ||
}); | ||
|
||
export const NImageGroup = defineVitePressAsyncComponent({ | ||
loader: () => import('naive-ui/es/image').then((m) => m.NImageGroup), | ||
loadingComponent: DefaultSlotCpt, | ||
}); | ||
|
||
const naiveComponents = { | ||
NImage, | ||
NImageGroup, | ||
}; | ||
|
||
export default naiveComponents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import 'uno.css'; | ||
import type { Theme } from 'vitepress'; | ||
import DefaultTheme from 'vitepress/theme'; | ||
import components from '../components'; | ||
import './custom.css'; | ||
import ImageTable from '../components/ImageTable.vue'; | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
enhanceApp({ app }) { | ||
app.component('ImageTable', ImageTable); | ||
Object.entries(components).forEach(([name, component]) => { | ||
app.component(name, component); | ||
}); | ||
}, | ||
} satisfies Theme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters