Browse Source

docs: update docs

pull/3993/head
vben 2 months ago
parent
commit
6147d13a29
  1. 3
      .husky/post-merge
  2. 7
      apps/web-antd/src/layouts/basic.vue
  3. 4
      apps/web-antd/vite.config.mts
  4. 5
      internal/lint-configs/eslint-config/src/custom-config.ts
  5. 4
      packages/@core/forward/preferences/src/config.ts
  6. 7
      packages/@core/shared/iconify/build.config.ts
  7. 20
      packages/@core/shared/iconify/package.json
  8. 18
      packages/business/widgets/src/preferences/blocks/layout/copyright.vue
  9. 1
      packages/business/widgets/src/preferences/preferences.vue
  10. 2
      packages/constants/src/vben.ts
  11. 29
      website/.vitepress/config.mts
  12. 28
      website/src/en/index.md
  13. 18
      website/src/index.md

3
.husky/post-merge

@ -0,0 +1,3 @@
# 每次 git pull 之后, 安装依赖
pnpm install

7
apps/web-antd/src/layouts/basic.vue

@ -13,7 +13,7 @@ import { preferences } from '@vben-core/preferences';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { resetRoutes } from '#/router'; import { resetRoutes } from '#/router';
import { useAppStore } from '#/store';
import { useAccessStore, useAppStore } from '#/store';
const notifications = ref<NotificationItem[]>([ const notifications = ref<NotificationItem[]>([
{ {
@ -81,6 +81,7 @@ const menus = computed(() => [
]); ]);
const appStore = useAppStore(); const appStore = useAppStore();
const { userInfo } = useAccessStore();
const router = useRouter(); const router = useRouter();
async function handleLogout() { async function handleLogout() {
@ -102,11 +103,11 @@ function handleMakeAll() {
<BasicLayout @clear-preferences-and-logout="handleLogout"> <BasicLayout @clear-preferences-and-logout="handleLogout">
<template #user-dropdown> <template #user-dropdown>
<UserDropdown <UserDropdown
:avatar="preferences.app.defaultAvatar"
:avatar="userInfo?.avatar ?? preferences.app.defaultAvatar"
:menus="menus" :menus="menus"
:text="userInfo?.realName"
description="ann.vben@gmail.com" description="ann.vben@gmail.com"
tag-text="Pro" tag-text="Pro"
text="Vben Admin"
@logout="handleLogout" @logout="handleLogout"
/> />
</template> </template>

4
apps/web-antd/vite.config.mts

@ -27,12 +27,12 @@ export default defineConfig({
icons: [ icons: [
{ {
sizes: '192x192', sizes: '192x192',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.1/source/pwa-icon-192.png',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-192.png',
type: 'image/png', type: 'image/png',
}, },
{ {
sizes: '512x512', sizes: '512x512',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.1/source/pwa-icon-512.png',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-512.png',
type: 'image/png', type: 'image/png',
}, },
], ],

5
internal/lint-configs/eslint-config/src/custom-config.ts

@ -7,7 +7,7 @@ const restrictedImportIgnores = [
]; ];
const customConfig: Linter.FlatConfig[] = [ const customConfig: Linter.FlatConfig[] = [
// shadcn-ui 内部组件是自动生成的,这里忽略
// shadcn-ui 内部组件是自动生成的,不做太多限制
{ {
files: ['packages/@core/ui-kit/shadcn-ui/**/**'], files: ['packages/@core/ui-kit/shadcn-ui/**/**'],
rules: { rules: {
@ -61,7 +61,6 @@ const customConfig: Linter.FlatConfig[] = [
'no-restricted-imports': [ 'no-restricted-imports': [
'error', 'error',
{ {
// 如果需要,可以指定禁止特定的子路径
patterns: [ patterns: [
{ {
group: ['@vben/*'], group: ['@vben/*'],
@ -81,7 +80,6 @@ const customConfig: Linter.FlatConfig[] = [
'no-restricted-imports': [ 'no-restricted-imports': [
'error', 'error',
{ {
// 如果需要,可以指定禁止特定的子路径
patterns: [ patterns: [
{ {
group: ['@vben/*', '@vben-core/*'], group: ['@vben/*', '@vben-core/*'],
@ -107,7 +105,6 @@ const customConfig: Linter.FlatConfig[] = [
'no-restricted-imports': [ 'no-restricted-imports': [
'error', 'error',
{ {
// 如果需要,可以指定禁止特定的子路径
patterns: [ patterns: [
{ {
group: ['@vben/*'], group: ['@vben/*'],

4
packages/@core/forward/preferences/src/config.ts

@ -10,7 +10,7 @@ const defaultPreferences: Preferences = {
compact: false, compact: false,
contentCompact: 'wide', contentCompact: 'wide',
defaultAvatar: defaultAvatar:
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.0/source/avatar-v1.webp',
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/avatar-v1.webp',
dynamicTitle: true, dynamicTitle: true,
enablePreferences: true, enablePreferences: true,
isMobile: false, isMobile: false,
@ -46,7 +46,7 @@ const defaultPreferences: Preferences = {
logo: { logo: {
enable: true, enable: true,
source: source:
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.0/source/logo-v1.webp',
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp',
}, },
navigation: { navigation: {
accordion: true, accordion: true,

7
packages/@core/shared/iconify/build.config.ts

@ -0,0 +1,7 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});

20
packages/@core/shared/iconify/package.json

@ -10,14 +10,28 @@
}, },
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": {
"build": "pnpm unbuild",
"stub": "pnpm unbuild --stub"
},
"files": [ "files": [
"dist" "dist"
], ],
"main": "./src/index.ts",
"module": "./src/index.ts",
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": { "exports": {
".": { ".": {
"default": "./src/index.ts"
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
}
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
} }
}, },
"dependencies": { "dependencies": {

18
packages/business/widgets/src/preferences/blocks/layout/copyright.vue

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue';
import { $t } from '@vben-core/locales'; import { $t } from '@vben-core/locales';
import InputItem from '../input-item.vue'; import InputItem from '../input-item.vue';
@ -8,6 +10,8 @@ defineOptions({
name: 'PreferenceBreadcrumbConfig', name: 'PreferenceBreadcrumbConfig',
}); });
const props = defineProps<{ disabled: boolean }>();
const copyrightEnable = defineModel<boolean>('copyrightEnable'); const copyrightEnable = defineModel<boolean>('copyrightEnable');
const copyrightDate = defineModel<string>('copyrightDate'); const copyrightDate = defineModel<string>('copyrightDate');
const copyrightIcp = defineModel<string>('copyrightIcp'); const copyrightIcp = defineModel<string>('copyrightIcp');
@ -16,27 +20,29 @@ const copyrightCompanyName = defineModel<string>('copyrightCompanyName');
const copyrightCompanySiteLink = defineModel<string>( const copyrightCompanySiteLink = defineModel<string>(
'copyrightCompanySiteLink', 'copyrightCompanySiteLink',
); );
const itemDisabled = computed(() => props.disabled || !copyrightEnable.value);
</script> </script>
<template> <template>
<SwitchItem v-model="copyrightEnable">
<SwitchItem v-model="copyrightEnable" :disabled="disabled">
{{ $t('preferences.copyright.enable') }} {{ $t('preferences.copyright.enable') }}
</SwitchItem> </SwitchItem>
<InputItem v-model="copyrightCompanyName" :disabled="!copyrightEnable">
<InputItem v-model="copyrightCompanyName" :disabled="itemDisabled">
{{ $t('preferences.copyright.company-name') }} {{ $t('preferences.copyright.company-name') }}
</InputItem> </InputItem>
<InputItem v-model="copyrightCompanySiteLink" :disabled="!copyrightEnable">
<InputItem v-model="copyrightCompanySiteLink" :disabled="itemDisabled">
{{ $t('preferences.copyright.company-site-link') }} {{ $t('preferences.copyright.company-site-link') }}
</InputItem> </InputItem>
<InputItem v-model="copyrightDate" :disabled="!copyrightEnable">
<InputItem v-model="copyrightDate" :disabled="itemDisabled">
{{ $t('preferences.copyright.date') }} {{ $t('preferences.copyright.date') }}
</InputItem> </InputItem>
<InputItem v-model="copyrightIcp" :disabled="!copyrightEnable">
<InputItem v-model="copyrightIcp" :disabled="itemDisabled">
{{ $t('preferences.copyright.icp') }} {{ $t('preferences.copyright.icp') }}
</InputItem> </InputItem>
<InputItem v-model="copyrightIcpLink" :disabled="!copyrightEnable">
<InputItem v-model="copyrightIcpLink" :disabled="itemDisabled">
{{ $t('preferences.copyright.icp-link') }} {{ $t('preferences.copyright.icp-link') }}
</InputItem> </InputItem>
</template> </template>

1
packages/business/widgets/src/preferences/preferences.vue

@ -351,6 +351,7 @@ async function handleReset() {
v-model:copyright-enable="copyrightEnable" v-model:copyright-enable="copyrightEnable"
v-model:copyright-icp="copyrightIcp" v-model:copyright-icp="copyrightIcp"
v-model:copyright-icp-link="copyrightIcpLink" v-model:copyright-icp-link="copyrightIcpLink"
:disabled="!footerEnable"
/> />
</Block> </Block>
</template> </template>

2
packages/constants/src/vben.ts

@ -7,5 +7,5 @@ const VBEN_GITHUB_URL = 'https://github.com/vbenjs/vue-vben-admin';
* @zh_CN Vben Logo * @zh_CN Vben Logo
*/ */
const VBEN_LOGO = const VBEN_LOGO =
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.1/source/logo-v1.webp';
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp';
export { VBEN_GITHUB_URL, VBEN_LOGO }; export { VBEN_GITHUB_URL, VBEN_LOGO };

29
website/.vitepress/config.mts

@ -1,15 +1,35 @@
import { defineConfigWithTheme } from 'vitepress'; import { defineConfigWithTheme } from 'vitepress';
export default defineConfigWithTheme({ export default defineConfigWithTheme({
description: 'Vben Admin Pro Doc',
description: 'Vben Admin Pro & 企业级管理系统框架',
lang: 'zh-CN', lang: 'zh-CN',
locales: {
en: {
label: 'English',
lang: 'en',
link: '/en/index',
},
root: {
label: '简体中文',
lang: 'zh-CN',
},
},
srcDir: 'src', srcDir: 'src',
themeConfig: { themeConfig: {
editLink: {
pattern: 'https://github.com/vbenjs/vue-vben-admin/edit/main/docs/:path',
text: 'Edit this page on GitHub',
},
footer: {
copyright: 'Copyright © 2024-present Vben Admin Pro',
},
i18nRouting: true,
logo: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp',
nav: [ nav: [
{ link: '/', text: 'Home' }, { link: '/', text: 'Home' },
{ link: '/markdown-examples', text: 'Examples' }, { link: '/markdown-examples', text: 'Examples' },
], ],
sidebar: [ sidebar: [
{ {
text: 'Examples', text: 'Examples',
@ -19,12 +39,11 @@ export default defineConfigWithTheme({
], ],
}, },
], ],
siteTitle: 'Vben Admin Pro',
socialLinks: [ socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
{ icon: 'github', link: 'https://github.com/vbenjs/vue-vben-admin' },
], ],
}, },
title: 'Vben Admin Pro',
vite: { vite: {
build: { build: {
chunkSizeWarningLimit: Infinity, chunkSizeWarningLimit: Infinity,

28
website/src/en/index.md

@ -0,0 +1,28 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home
sidebar: false
hero:
name: 'Vben Admin Pro'
text: '企业级管理系统框架 - EN'
tagline: 开箱即用,简单高效
image:
src: https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp
alt: Vben Admin Pro
actions:
- theme: brand
text: 开始
link: /guide/
- theme: alt
text: 在 GitHub 查看
link: https://github.com/vbenjs/vue-vben-admin
features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

18
website/src/index.md

@ -1,18 +1,22 @@
--- ---
# https://vitepress.dev/reference/default-theme-home-page # https://vitepress.dev/reference/default-theme-home-page
layout: home layout: home
sidebar: false
hero: hero:
name: 'My Awesome Project'
text: 'A VitePress Site'
tagline: My great project tagline
name: 'Vben Admin Pro'
text: '企业级管理系统框架'
tagline: 开箱即用,简单高效
image:
src: https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp
alt: Vben Admin Pro
actions: actions:
- theme: brand - theme: brand
text: Markdown Examples
link: /markdown-examples
text: 开始
link: /guide/
- theme: alt - theme: alt
text: API Examples
link: /api-examples
text: 在 GitHub 查看
link: https://github.com/vbenjs/vue-vben-admin
features: features:
- title: Feature A - title: Feature A

Loading…
Cancel
Save