Skip to content

Commit

Permalink
增加 vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxinhao committed Jan 18, 2024
1 parent b6c5c83 commit e5b0c68
Show file tree
Hide file tree
Showing 12 changed files with 701 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

/docs/.vitepress/cache
32 changes: 32 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "实现Vue核心模块",
description: "vue3学习与思考",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'reactive', link: '../reactive/index.md' }
],

sidebar: [
{
text: 'Reactive',
items: [
{ text: 'MVP模型', link: '../reactive/实现vue3响应式系统核心-MVP模型.md' },
{ text: '依赖清理', link: '../reactive/实现vue3响应式系统核心-依赖清理.md' },
{ text: '嵌套effect', link: '../reactive/实现vue3响应式系统核心-嵌套effect.md' },
{ text: 'scheduler', link: '../reactive/实现vue3响应式系统核心-scheduler.md' },
{ text: 'MVP模型', link: '../reactive/实现vue3响应式系统核心-computed.md' },
{ text: 'MVP模型', link: '../reactive/实现vue3响应式系统核心-watch.md' },
]
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/SuYxh/share-vue3' }
]
}
})
25 changes: 25 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "实现Vue核心模块"
text: "vue3学习与思考"
tagline: Study hard
actions:
- theme: brand
text: Go -->
link: ./reactive/index
# - theme: alt
# text: API Examples
# link: /api-examples

features:
- title: Reactivity
details: Vue 3 的响应式系统使用 ES6 的 Proxy 特性来追踪和响应数据状态的改变,为构建动态用户界面提供了高效的数据绑定和更新机制
- title: Runtime
details: Vue 3 的运行时环境负责处理模板到真实 DOM 的渲染,组件的生命周期管理,以及通过优化和 Tree-shaking 提供更快速、轻量级的应用性能
- title: Compiler
details: Vue 3 的编译器将模板代码转换成高效的 JavaScript 渲染函数,通过编译时优化提高应用运行时的性能和效率
---

72 changes: 72 additions & 0 deletions docs/reactive/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
### 响应式系统

#### 已实现

- [x] 响应式数据以及副作用函数
- [x] 响应式系统MVP模型
- [x] 依赖收集
- [x] 派发更新
- [x] 依赖清理
- [x] 嵌套 effect
- [x] scheduler
- [x] computed
- [x] watch



#### 系列文章

- [实现vue3响应式系统核心-MVP模型](./docs/实现vue3响应式系统核心-MVP模型.md)
- [实现vue3响应式系统核心-依赖清理](./docs/实现vue3响应式系统核心-依赖清理.md)
- [实现vue3响应式系统核心-嵌套effect](./docs/实现vue3响应式系统核心-嵌套effect.md)
- [实现vue3响应式系统核心-scheduler](./docs/实现vue3响应式系统核心-scheduler.md)
- [实现vue3响应式系统核心-computed](./docs/实现vue3响应式系统核心-computed.md)
- [实现vue3响应式系统核心-watch](./docs/实现vue3响应式系统核心-watch.md)



#### 流程图

##### 响应式数据结构

![image-20240118223902472](https://qn.huat.xyz/mac/202401182239504.png)





##### 响应式系统 MVP 模型

![image-20240118223949999](https://qn.huat.xyz/mac/202401182239017.png)



##### 依赖清理

![image-20240118224016622](https://qn.huat.xyz/mac/202401182240651.png)

##### 嵌套 effect

![image-20240118224141690](https://qn.huat.xyz/mac/202401182241712.png)

##### scheduler

![image-20240118224210357](https://qn.huat.xyz/mac/202401182242379.png)

##### computed

![image-20240118224353017](https://qn.huat.xyz/mac/202401182243042.png)



##### watch

![image-20240118224413560](https://qn.huat.xyz/mac/202401182244587.png)





### 参考

1、《vuejs 设计与实现》霍春阳
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest"
"test": "vitest",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8",
"vitepress": "^1.0.0-rc.39",
"vitest": "^1.2.0"
}
}
}
Loading

0 comments on commit e5b0c68

Please sign in to comment.