├── .gitignore ├── .gitmodules ├── .vscode └── settings.json ├── README.md ├── assets ├── Snip20201215_6.png └── old.md ├── demo ├── api │ ├── base-api.html │ ├── compositions.html │ └── options.html ├── compositions-api │ ├── button.html │ └── useMouse.html ├── helloworld │ ├── composition.html │ └── options.html ├── reactivity-demo │ ├── __test__ │ │ ├── vue2.spec.js │ │ └── vue3.spec.js │ ├── vue2.js │ └── vue3.js ├── vue-cli-2 │ ├── .browserslistrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ └── src │ │ ├── App.vue │ │ ├── assets │ │ └── logo.png │ │ ├── components │ │ └── HelloWorld.vue │ │ ├── main.js │ │ ├── router │ │ └── index.js │ │ ├── store │ │ └── index.js │ │ └── views │ │ ├── About.vue │ │ └── Home.vue └── vue-cli-3 │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── main.js │ ├── router │ │ └── index.js │ ├── store │ │ └── index.js │ └── views │ │ ├── About.vue │ │ └── Home.vue │ └── vue.config.js ├── mini-rollup ├── acorn │ ├── index.js │ ├── scope.js │ └── walk.js ├── bundle.js ├── debugger.js ├── lib │ ├── ast │ │ ├── analyse.js │ │ ├── scope.js │ │ └── walk.js │ ├── bundle.js │ ├── example.js │ ├── module.js │ └── rollup.js ├── magic-string.js ├── package.json ├── src │ ├── c.js │ ├── foo.js │ └── main.js └── yarn.lock ├── mini-vite ├── index.html ├── index.js ├── package.json ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── index.css │ └── main.js └── yarn.lock ├── mini-vue-plus ├── .vscode │ └── settings.json ├── App.js ├── core │ ├── h.js │ ├── index.js │ ├── reactivity │ │ └── index.js │ └── renderer │ │ └── index.js ├── index.html ├── index.js └── package.json ├── mini-vue ├── 00_original.html ├── 01_mvvm.html ├── 02_reactivity.html ├── 03-render.html ├── compiler │ ├── ast.js │ └── simple.js ├── complete │ ├── App.js │ ├── core │ │ ├── h.js │ │ ├── index.js │ │ ├── reactivity │ │ │ └── index.js │ │ └── renderer.js │ ├── index.html │ └── main.js ├── options_api │ ├── 00_original.html │ ├── 01_mvvm.html │ └── 02_reactivity.html ├── package.json ├── reactivity │ ├── __test__ │ │ └── index.spec.js │ └── index.js └── runtime │ ├── diff │ ├── __tests__ │ │ └── index.spec.js │ └── index.js │ ├── h.js │ └── renderer.js ├── mini-vuepress ├── README.md ├── index.js ├── markdown │ ├── __tests__ │ │ ├── index.spec.js │ │ ├── test.css │ │ └── test.md │ ├── index.js │ └── mark.css ├── package.json ├── scaner.js ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── index.css │ └── main.js ├── ssr │ ├── App.vue │ ├── __tests__ │ │ └── index.spec.js │ ├── index.html │ ├── index.js │ ├── list.js │ └── server.js ├── template │ └── App.vue ├── vite │ ├── README.md │ ├── index.html │ └── index.js └── yarn.lock ├── petitevue └── counter │ ├── composition.html │ ├── options.html │ ├── petite.html │ └── vuex.html ├── scalingup ├── Vue3规模化.md ├── router │ └── index.html ├── ssr │ ├── App.vue │ ├── index.js │ └── package.json └── state │ └── index.html ├── toolchain ├── babel │ └── index.js ├── package.json ├── yarn-error.log └── yarn.lock ├── vue-mastery ├── composition-api │ ├── README.md │ ├── demo │ │ ├── .gitignore │ │ ├── README.assets │ │ │ ├── image-20201206165135473.png │ │ │ ├── image-20201206171613601.png │ │ │ ├── image-20201206172905686.png │ │ │ └── image-20201206174225781.png │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ └── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ ├── flower.webm │ │ │ └── logo.png │ │ │ ├── components │ │ │ ├── Computed.vue │ │ │ ├── LifecycleHooks.js │ │ │ ├── Method.vue │ │ │ ├── Modularizing │ │ │ │ ├── Modularzing.vue │ │ │ │ └── index.js │ │ │ ├── Setup.vue │ │ │ ├── SharingState │ │ │ │ ├── Origin.vue │ │ │ │ ├── SharingState.vue │ │ │ │ ├── index.js │ │ │ │ └── usePromise.js │ │ │ ├── Suspense │ │ │ │ ├── Event.vue │ │ │ │ ├── Suspense.vue │ │ │ │ └── index.js │ │ │ ├── Teleport.vue │ │ │ ├── Watch.vue │ │ │ ├── composables │ │ │ │ └── use-event-space.js │ │ │ └── reactiveSynatx.vue │ │ │ ├── index.css │ │ │ └── main.js │ └── sub │ │ ├── 01_composition_api.srt │ │ ├── 02_setup&ref.srt │ │ ├── 03_methods.srt │ │ ├── 04_computedproperties.srt │ │ ├── 05_reactivesynatx.srt │ │ ├── 06_modularizing.srt │ │ ├── 07_lifecyclehooks.srt │ │ ├── 08_watch.srt │ │ ├── 09_sharingstate.srt │ │ ├── 10_suspense.srt │ │ └── 11_teleport.srt └── deep-dive │ ├── README.md │ └── demo │ ├── 13 │ ├── ScopeSlots.html │ ├── compositionAPI.html │ ├── higherOrderCompent.html │ ├── mouse.html │ ├── reusable.html │ └── vue-mastery-DiveP13.md │ ├── 03 │ ├── render-fn.js │ └── stack.html │ ├── 04 │ ├── render-fn.js │ └── vdom.html │ └── reactivity.html └── vuex ├── 01-introduction └── cdn.html ├── 02-core-concepts ├── 01-state.html ├── 02-getter.html ├── 03-mutation.html ├── 04-action.html └── 05-module │ ├── 01-basic.html │ ├── 02-namespace.html │ └── 03-register.html ├── 03-advanced ├── 02-composition-api.html ├── 03-plugins │ ├── 01-helloworld.html │ └── 02-websocket │ │ ├── index.html │ │ ├── index.js │ │ └── package.json ├── 04-strict-mode │ └── index.html ├── 05-form │ └── index.html ├── 06-testing │ ├── api │ │ └── shop.js │ ├── demo │ │ ├── moduleA.js │ │ └── test.js │ ├── index.html │ ├── package.json │ ├── store │ │ ├── __tests__ │ │ │ ├── actions.spec.js │ │ │ ├── getters.spec.js │ │ │ ├── hello.js │ │ │ ├── index.js │ │ │ └── mutations.spec.js │ │ ├── actions.js │ │ ├── getters.js │ │ └── store.js │ ├── webpack.config.js │ ├── webpack.dev.config.js │ ├── yarn-error.log │ └── yarn.lock └── 08-typescript │ ├── .browserslistrc │ ├── .gitignore │ ├── 02-composition-api.html │ ├── README.md │ ├── babel.config.js │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── main.ts │ ├── router │ │ └── index.ts │ ├── shims-vue.d.ts │ ├── store │ │ └── index.ts │ ├── views │ │ ├── About.vue │ │ └── Home.vue │ └── vuex.d.ts │ ├── tsconfig.json │ └── yarn.lock ├── README.md └── source ├── .gitignore ├── README.md ├── babel.config.js ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ └── logo.png ├── components │ ├── Getter.js │ ├── HelloWorld.js │ ├── Mutation.js │ └── State.js └── main.js ├── vue.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | package-lock.json 3 | **/.DS_Store 4 | **/dist/ 5 | webpack/bundle.js 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source/vue-next"] 2 | path = source/vue-next 3 | url = https://github.com/vuejs/vue-next 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | 然叔的Vue3.0学习笔记 4 | 5 | ## 🏠欢迎一起交流 6 | 微信公众号 🔍【前端大班车】 ,多位【🔥Vue3代码贡献者】带你飞🚀 7 | 8 | ## 目录结构 9 | 10 | ``` 11 | . 12 | ├── mini-vite // 简写版Vite 13 | ├── mini-webpack // 简写版webpack 14 | ├── mini-vue // 简写版Vue 15 | ├── mini-vue-plus // Vue(B站天天造轮子版) 16 | ├── vue-mastery // Vue-Mastery 内容demo 17 | ├── template-explorer // Vue3模板编译调试工具 18 | ├── demo // Vue基础APIDemo 19 | ├── source // vue3源码 submodule 20 | └── vue-next-cli-demo // Vue3 CLI工具Demo 21 | ``` 22 | 23 | 24 | 25 | 26 | 27 | ## 掘金和语雀精华 28 | 29 |  30 | 31 | [📖语雀 - VueMastery学习笔记](https://www.yuque.com/nxtt7g/kompdt) 32 | 33 | 34 | 35 | - [Vue3.0全球发布会干货总结](https://juejin.cn/post/6875236411349008398) 36 | - [如何参加开源项目-如何给Vue3.0提PR](https://juejin.cn/post/6844904191744278542) 37 | - [跟我一起编写Vue3版ElementUI](https://juejin.cn/post/6864462363039531022) 38 | 39 | - [忙了一夜用CompositionAPI征服产品妹子花里胡哨的需求](https://juejin.cn/post/6891885484524437518) 40 | 41 | - [闪电五连鞭:Composition API原理深度剖析](https://juejin.cn/post/6894993303486332941) 42 | - [又是一夜,这篇Composition-API实操还觉得短吗](https://juejin.cn/post/6892017198450081800) 43 | - [拿下vue3你要做好这些准备](https://juejin.cn/post/6866373381424414734) 44 | 45 | 46 | ## B站热门视频教程 47 | - [【全网首发】Vue3.0光速上手「持续更新中」](https://www.bilibili.com/video/BV1Wh411X7Xp) 48 | 49 | - [【Vue Mastery】composition API + 深度解读](https://www.bilibili.com/video/BV1my4y1m7sz) 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /assets/Snip20201215_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/su37josephxia/learn-vue3/49981acb1816e5e8a02da86896206c50b9839724/assets/Snip20201215_6.png -------------------------------------------------------------------------------- /assets/old.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ## 参考资料 7 | 8 | ### 试用Vue3 9 | 10 | > 参考资料 https://blog.csdn.net/guotianqing/article/details/82391665 11 | 12 | ### 初始化子模块 13 | 14 | ```bash 15 | git submodule add https://github.com/vuejs/vue-next source/vue-next 16 | ``` 17 | 18 | 子模块内容记录在.gitmodules文件中 19 | 20 | ```bash 21 | # 初始化子模块 22 | git submodule init 23 | # 更新模块 24 | git submodule update --init --recursive 25 | ``` 26 | 27 | ### 安装依赖 28 | 29 | ``` bash 30 | ## 修改镜像 31 | yarn config set registry https://registry.npm.taobao.org --global 32 | yarn config set disturl https://npm.taobao.org/dist --global 33 | 34 | ## 去除pupteer 35 | # 忽略下载Chromium 36 | cd source/vue-next 37 | ## 去除pupteer 38 | yarn --ignore-scripts 39 | 40 | ``` 41 | 42 | ### 编译Build 43 | 44 | ``` bash 45 | cd source/vue-next 46 | yarn build 47 | ``` 48 | 49 | ### 调试Vue代码 50 | 51 | ``` bash 52 | cd source/vue-next 53 | yarn build 54 | ``` 55 | 56 | ### 测试API 57 | 58 | -------------------------------------------------------------------------------- /demo/api/compositions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |Edit components/HelloWorld.vue
to test hot module replacement.
Edit components/HelloWorld.vue
to test hot module replacement.
-------------------------------------------------------------------------------- /mini-vuepress/ssr/index.js: -------------------------------------------------------------------------------- 1 | const Vue = require('vue') // vue@next 2 | const serverRenderer = require('@vue/server-renderer') 3 | const compilerSsr = require('@vue/compiler-ssr') 4 | const compilerSfc = require('@vue/compiler-sfc') 5 | const fs = require('fs') 6 | 7 | module.exports.createRender = path => { 8 | const { descriptor } = compilerSfc.parse(fs.readFileSync(path, 'utf-8')) 9 | const render = compilerSsr.compile(descriptor.template.content).code 10 | 11 | return async (data) => { 12 | const app = Vue.createApp({ 13 | ssrRender: new Function('require',render)(require), // 写法二 14 | data: () => data 15 | }) 16 | return serverRenderer.renderToString(app) 17 | } 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /mini-vuepress/ssr/list.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | template: `
`, 17 | data(){ 18 | return { 19 | todos:['吃饭','睡觉'] 20 | } 21 | } 22 | } 23 | 24 | 25 | // const self = (global || root) 26 | 27 | // self.performance = { 28 | // now: function () { 29 | // var hrtime = process.hrtime() 30 | // return ((hrtime[0] * 1000000 + hrtime[1] / 1000) / 1000) 31 | // } 32 | // } 33 | 34 | // function generateGrid (rowCount, columnCount) { 35 | // var grid = [] 36 | 37 | // for (var r = 0; r < rowCount; r++) { 38 | // var row = { id: r, items: [] } 39 | // for (var c = 0; c < columnCount; c++) { 40 | // row.items.push({ id: (r + '-' + c) }) 41 | // } 42 | // grid.push(row) 43 | // } 44 | 45 | // return grid 46 | // } 47 | 48 | // const gridData = generateGrid(100, 5) 49 | 50 | // module.exports = { 51 | // template: '
', 52 | // components: { 53 | // myTable: { 54 | // data: function () { 55 | // return { 56 | // grid: gridData 57 | // } 58 | // }, 59 | // // template: '
123 | {{ item.id }} |
---|
', 60 | // template: '
', 61 | // components: { 62 | // row: { 63 | // props: ['row'], 64 | // template: '
', 65 | // components: { 66 | // column: { 67 | // template: '
'
75 | // }
76 | // }
77 | // }
78 | // }
79 | // }
80 | // }
81 | // }
82 |
--------------------------------------------------------------------------------
/mini-vuepress/ssr/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const vueapp = require('./list')
4 | const Vue = require('vue') // vue@next
5 | const serverRenderer = require('@vue/server-renderer')
6 | const compilerSsr = require('@vue/compiler-ssr')
7 | const compilerSfc = require('@vue/compiler-sfc')
8 | const fs = require('fs')
9 | vueapp.ssrRender = new Function('require', compilerSsr.compile(vueapp.template).code)(require)
10 |
11 | app.get('/', async function (req, res) {
12 | const { descriptor } = compilerSfc.parse(fs.readFileSync('./App.vue', 'utf-8'))
13 | console.log(descriptor.template.content)
14 |
15 | const data = () => ({
16 | todos: ['吃饭', '睡觉']
17 | })
18 |
19 | const render = compilerSsr.compile(descriptor.template.content).code
20 |
21 | let vapp = Vue.createApp({
22 | // template: descriptor.template.content, // 写法一
23 | ssrRender: new Function('require',render)(require), // 写法二
24 | data
25 | })
26 | let html = await serverRenderer.renderToString(vapp)
27 |
28 | res.send(html)
29 | })
30 |
31 | app.listen(9093, () => {
32 | console.log('listen 9093')
33 | })
34 |
--------------------------------------------------------------------------------
/mini-vuepress/template/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
25 |
27 |
4 | 5 | 6 | 7 |
8 | 9 |
24 |