mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
23 lines
472 B
TypeScript
23 lines
472 B
TypeScript
|
import { computed } from 'vue'
|
||
|
import { useData } from 'vitepress'
|
||
|
import { createGitHubUrl } from '../utils'
|
||
|
|
||
|
import type { Ref } from 'vue'
|
||
|
|
||
|
export const useSourceCode = (path: Ref<string>) => {
|
||
|
const { theme } = useData()
|
||
|
|
||
|
const demoUrl = computed(() => {
|
||
|
const {
|
||
|
repo,
|
||
|
docsDir = '',
|
||
|
docsBranch = 'dev',
|
||
|
docsRepo = repo,
|
||
|
} = theme.value
|
||
|
|
||
|
return createGitHubUrl(docsRepo, docsDir, docsBranch, path.value)
|
||
|
})
|
||
|
|
||
|
return demoUrl
|
||
|
}
|