Skip to content

Commit

Permalink
docs: packages transfer @Site-Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
cole committed Aug 9, 2024
1 parent b6b7663 commit 7b8d24c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## packages 后续将迁移到 https://github.com/ColeWang/site-pro 并使用 tsx

将使用 npm 引入

import { Table } from '@site-pro/components'

import { Screen } from '@site-pro/plugins'
1 change: 1 addition & 0 deletions packages/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './version'
export * from './install-site'
export * from './plugins'
export * from './components'
3 changes: 2 additions & 1 deletion packages/install-site.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { inject } from 'vue'
import { Fullscreen, Loading, Progress, Screen } from './plugins'
import { version } from './version'
import { forEach, omit } from 'lodash-es'

const BaseKey = Symbol('Site')
Expand All @@ -15,7 +16,7 @@ function install (app, options) {
const { config: pluginConfig } = options

const $site = {
version: __SITE_VERSION__,
version: version,
config: pluginConfig
}

Expand Down
19 changes: 19 additions & 0 deletions packages/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { gt, head, lt, split, zipWith } from 'lodash-es'

const version = __SITE_VERSION__ || '0.3.0'

function parse (version) {
return split(version, '.', 3).map(Number)
}

function compare (v1, v2, operation) {
const result = zipWith(parse(v1), parse(v2), (a, b) => {
return (gt(a, b) && 1) || (lt(a, b) && -1) || 0
}).filter((value) => value !== 0)
return operation(head(result) || 0)
}

export {
version,
compare
}
12 changes: 8 additions & 4 deletions src/layout/compatible/container/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default defineComponent({
type: Array,
default: () => ([])
},
maxCache: {
type: [Number, String],
default: 10
},
header: {
type: Function,
default: undefined
Expand All @@ -22,13 +26,13 @@ export default defineComponent({
}
},
setup (props, { slots, attrs }) {
const spaceRef = ref(null)

const { prefixCls } = useConfigInject('pro-layout-container', props)
const [wrapSSR, hashId] = useStyle(prefixCls)

const spaceRef = ref(null)

return () => {
const { include } = props
const { include, maxCache } = props

const headerDom = getSlotVNode(slots, props, 'header')
const footerDom = getSlotVNode(slots, props, 'footer')
Expand All @@ -43,7 +47,7 @@ export default defineComponent({
<RouterView>
{({ Component }) => {
return (
<KeepAlive max={10} include={include}>
<KeepAlive include={include} max={maxCache}>
{Component}
</KeepAlive>
)
Expand Down
1 change: 1 addition & 0 deletions src/utils/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class GalleryCache {
export const localCache = new GalleryCache(localStorage)
export const sessionCache = new GalleryCache(sessionStorage)

export const VERSION__LOCAL = 'version'
export const TAGS__LOCAL = 'tags'
export const LOCALE__LOCAL = 'locale'
export const THEME__LOCAL = 'theme'
Expand Down

0 comments on commit 7b8d24c

Please sign in to comment.