forked from opentiny/tiny-vue
docs(sites): add 3.14 version playground (#1470)
This commit is contained in:
parent
1f612a2caa
commit
5813c77cc0
|
@ -17,7 +17,7 @@ import logoUrl from './assets/opentiny-logo.svg?url'
|
||||||
import GitHub from './icons/Github.vue'
|
import GitHub from './icons/Github.vue'
|
||||||
import Share from './icons/Share.vue'
|
import Share from './icons/Share.vue'
|
||||||
|
|
||||||
const VERSION = 'tiny-vue-version-3.13'
|
const VERSION = 'tiny-vue-version-3.14'
|
||||||
const LAYOUT = 'playground-layout'
|
const LAYOUT = 'playground-layout'
|
||||||
const LAYOUT_REVERSE = 'playground-layout-reverse'
|
const LAYOUT_REVERSE = 'playground-layout-reverse'
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ const isMobileFirst = tinyMode === 'mobile-first'
|
||||||
const isSaas = tinyTheme === 'saas'
|
const isSaas = tinyTheme === 'saas'
|
||||||
const isPreview = searchObj.get('openMode') === 'preview' // 是否多端弹窗预览
|
const isPreview = searchObj.get('openMode') === 'preview' // 是否多端弹窗预览
|
||||||
|
|
||||||
const versions = ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
|
const versions = ['3.14', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
|
||||||
const latestVersion = isPreview ? versions[0] : localStorage.getItem(VERSION) || versions[0]
|
const latestVersion = isPreview ? versions[0] : localStorage.getItem(VERSION) || versions[0]
|
||||||
const cdnHost = localStorage.getItem('setting-cdn')
|
const cdnHost = localStorage.getItem('setting-cdn')
|
||||||
const getRuntime = (version) => {
|
const getRuntime = (version) => {
|
||||||
|
@ -36,19 +36,6 @@ const getRuntime = (version) => {
|
||||||
return `${cdnHost}/@opentiny/vue@${useVersion}/runtime/`
|
return `${cdnHost}/@opentiny/vue@${useVersion}/runtime/`
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeImportSuffix = (imports, verison) => {
|
|
||||||
const newImports = {}
|
|
||||||
Object.keys(imports).forEach((key) => {
|
|
||||||
const url = imports[key]
|
|
||||||
if (url.startsWith(getRuntime(verison))) {
|
|
||||||
newImports[key] = url.replace('.mjs', '.js')
|
|
||||||
} else {
|
|
||||||
newImports[key] = url
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return newImports
|
|
||||||
}
|
|
||||||
|
|
||||||
const createImportMap = (version) => {
|
const createImportMap = (version) => {
|
||||||
const imports = {
|
const imports = {
|
||||||
'@opentiny/vue': `${getRuntime(version)}tiny-vue.mjs`,
|
'@opentiny/vue': `${getRuntime(version)}tiny-vue.mjs`,
|
||||||
|
@ -67,7 +54,7 @@ const createImportMap = (version) => {
|
||||||
imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
|
imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
imports: changeImportSuffix(imports, version)
|
imports
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,9 +62,6 @@ const getTinyTheme = (version) => {
|
||||||
if (isMobileFirst) {
|
if (isMobileFirst) {
|
||||||
return `${getRuntime(version)}tailwind.css`
|
return `${getRuntime(version)}tailwind.css`
|
||||||
}
|
}
|
||||||
if (isSaas) {
|
|
||||||
return `${getRuntime(version)}index.css`
|
|
||||||
}
|
|
||||||
let theme = tinyTheme
|
let theme = tinyTheme
|
||||||
if (!['smb', 'default', 'aurora', 'saas'].includes(theme)) {
|
if (!['smb', 'default', 'aurora', 'saas'].includes(theme)) {
|
||||||
theme = 'default'
|
theme = 'default'
|
||||||
|
|
Loading…
Reference in New Issue