Skip to content

Commit

Permalink
docs(sites): add 3.14 version playground (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
gimmyhehe authored Mar 7, 2024
1 parent 1f612a2 commit 5813c77
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions examples/sites/playground/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import logoUrl from './assets/opentiny-logo.svg?url'
import GitHub from './icons/Github.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_REVERSE = 'playground-layout-reverse'
Expand All @@ -28,27 +28,14 @@ const isMobileFirst = tinyMode === 'mobile-first'
const isSaas = tinyTheme === 'saas'
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 cdnHost = localStorage.getItem('setting-cdn')
const getRuntime = (version) => {
const useVersion = import.meta.env.VITE_PLAYGROUND_VERIOSN || version
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 imports = {
'@opentiny/vue': `${getRuntime(version)}tiny-vue.mjs`,
Expand All @@ -67,17 +54,14 @@ const createImportMap = (version) => {
imports['@opentiny/vue-icon'] = `${getRuntime(version)}tiny-vue-icon-saas.mjs`
}
return {
imports: changeImportSuffix(imports, version)
imports
}
}
const getTinyTheme = (version) => {
if (isMobileFirst) {
return `${getRuntime(version)}tailwind.css`
}
if (isSaas) {
return `${getRuntime(version)}index.css`
}
let theme = tinyTheme
if (!['smb', 'default', 'aurora', 'saas'].includes(theme)) {
theme = 'default'
Expand Down

0 comments on commit 5813c77

Please sign in to comment.