Skip to content

Commit 7b8d24c

Browse files
author
cole
committed
docs: packages transfer @Site-Pro
1 parent b6b7663 commit 7b8d24c

File tree

6 files changed

+38
-5
lines changed

6 files changed

+38
-5
lines changed

packages/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## packages 后续将迁移到 https://github.com/ColeWang/site-pro 并使用 tsx
2+
3+
将使用 npm 引入
4+
5+
import { Table } from '@site-pro/components'
6+
7+
import { Screen } from '@site-pro/plugins'

packages/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './version'
12
export * from './install-site'
23
export * from './plugins'
34
export * from './components'

packages/install-site.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { inject } from 'vue'
22
import { Fullscreen, Loading, Progress, Screen } from './plugins'
3+
import { version } from './version'
34
import { forEach, omit } from 'lodash-es'
45

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

1718
const $site = {
18-
version: __SITE_VERSION__,
19+
version: version,
1920
config: pluginConfig
2021
}
2122

packages/version.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { gt, head, lt, split, zipWith } from 'lodash-es'
2+
3+
const version = __SITE_VERSION__ || '0.3.0'
4+
5+
function parse (version) {
6+
return split(version, '.', 3).map(Number)
7+
}
8+
9+
function compare (v1, v2, operation) {
10+
const result = zipWith(parse(v1), parse(v2), (a, b) => {
11+
return (gt(a, b) && 1) || (lt(a, b) && -1) || 0
12+
}).filter((value) => value !== 0)
13+
return operation(head(result) || 0)
14+
}
15+
16+
export {
17+
version,
18+
compare
19+
}

src/layout/compatible/container/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export default defineComponent({
1212
type: Array,
1313
default: () => ([])
1414
},
15+
maxCache: {
16+
type: [Number, String],
17+
default: 10
18+
},
1519
header: {
1620
type: Function,
1721
default: undefined
@@ -22,13 +26,13 @@ export default defineComponent({
2226
}
2327
},
2428
setup (props, { slots, attrs }) {
25-
const spaceRef = ref(null)
26-
2729
const { prefixCls } = useConfigInject('pro-layout-container', props)
2830
const [wrapSSR, hashId] = useStyle(prefixCls)
2931

32+
const spaceRef = ref(null)
33+
3034
return () => {
31-
const { include } = props
35+
const { include, maxCache } = props
3236

3337
const headerDom = getSlotVNode(slots, props, 'header')
3438
const footerDom = getSlotVNode(slots, props, 'footer')
@@ -43,7 +47,7 @@ export default defineComponent({
4347
<RouterView>
4448
{({ Component }) => {
4549
return (
46-
<KeepAlive max={10} include={include}>
50+
<KeepAlive include={include} max={maxCache}>
4751
{Component}
4852
</KeepAlive>
4953
)

src/utils/storage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class GalleryCache {
5757
export const localCache = new GalleryCache(localStorage)
5858
export const sessionCache = new GalleryCache(sessionStorage)
5959

60+
export const VERSION__LOCAL = 'version'
6061
export const TAGS__LOCAL = 'tags'
6162
export const LOCALE__LOCAL = 'locale'
6263
export const THEME__LOCAL = 'theme'

0 commit comments

Comments
 (0)