Vue源码结构是什么
这篇文章主要介绍Vue源码结构是什么,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联公司秉承实现全网价值营销的理念,以专业定制企业官网,成都网站设计、网站建设,小程序开发,网页设计制作,手机网站制作,营销型网站帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。
Vue版本:2.6.9
源码结构图
├─ .circleci // 包含CircleCI持续集成/持续部署工具的配置文件
├─ .github // 项目相关的说明文档,上面的说明文档就在此文件夹
├─ benchmarks // 基准,性能测试文件,Vue的跑分demo,比如大数据量的table或者渲染大量SVG
├─ dist // 构建后输出的不同版本Vue文件(UMD、CommonJS、ES 生产和开发包)
├─ examples // 部分示例,用Vue写的一些小demo
├─ flow // flow 因为Vue使用了 [Flow](https://flow.org/) 来进行静态类型检查,静态类型检查类型声明文件
├─ packages // 包含服务端渲染和模板编译器两种不同的NPM包,是提供给不同使用场景使用的
├─ scripts // 存放npm脚本配置文件,结合webpack、rollup进行编译、测试、构建等操作(使用者不需要关心)
│ ├─ alias.js // 模块导入所有源代码和测试中使用的别名
│ ├─ config.js // 包含在'dist/`中找到的所有文件的生成配置
│ ├─ build.js // 对 config.js 中所有的rollup配置进行构建
├─ src // 主要源码所在位置,核心内容
│ ├─ compiler // 解析模版相关
│ ├─ codegen // 把AST转换为Render函数
│ ├─ directives // 通用生成Render函数之前需要处理的指令
│ ├─ parser // 解析模版成AST
│ ├─ core // Vue核心代码,包括内置组件,全局API封装,Vue 实例化,观察者,虚拟DOM, 工具函数等等。
│ ├─ components // 组件相关属性,主要是Keep-Alive
│ ├─ global-api // Vue全局API,如Vue.use,Vue.extend,Vue.mixin等
│ ├─ instance // 实例化相关内容,生命周期、事件等
│ ├─ observer // 响应式核心目录,双向数据绑定相关文件
│ ├─ util // 工具方法
│ └─ vdom // 包含虚拟DOM 创建(creation)和打补丁(patching) 的代码
│ ├─ platforms // 和平台相关的内容,Vue.js 是一个跨平台的MVVM 框架(web、native、weex)
│ ├─ web // web端
│ ├─ compiler // web端编译相关代码,用来编译模版成render函数basic.js
│ ├─ runtime // web端运行时相关代码,用于创建Vue实例等
│ ├─ server // 服务端渲染
│ └─ util // 相关工具类
│ └─ weex // 基于通用跨平台的 Web 开发语言和开发经验,来构建 Android、iOS 和 Web 应用
│ ├─ server // 服务端渲染(ssr)
│ ├─ sfc // 转换单文件组件(*.vue)
│ └─ shared // 全局共享的方法和常量
├─ test // test 测试用例
├─ types // Vue新版本支持TypeScript,主要是TypeScript类型声明文件
├─ node_modules // npm包存放目录
|-- .babelrc.js // babel配置
|-- .editorconfig // 文本编码样式配置文件
|-- .eslintignore // eslint校验忽略文件
|-- .eslintrc.js // eslint配置文件
|-- .flowconfig // flow配置文件
|-- .gitignore // Git提交忽略文件配置
|-- BACKERS.md // 赞助者信息文件
|-- LICENSE // 项目开源协议
|-- package.json // 依赖
|-- README.md // 说明文件
|-- yarn.lock // yarn版本锁定文件
Vue 不同的构建版本对比
| UMD | CommonJS | ES Module (基于构建工具使用) | ES Module (直接用于浏览器) | | 完整版 | vue.js | vue.common.js | vue.esm.js | vue.esm.browser.js |
| 只包含运行时版 | vue.runtime.js | vue.runtime.common.js | vue.runtime.esm.js | - |
| 完整版 (生产环境) | vue.min.js | - | - | vue.esm.browser.min.js |
| 只包含运行时版 (生产环境) | vue.runtime.min.js | - | - | - |
术语解释
完整版:同时包含编译器和运行时的版本。
编译器:用来将模板字符串编译成为 JavaScript 渲染函数的代码。
运行时: 用来创建 Vue 实例、渲染并处理虚拟 DOM 等的代码。基本上就是除去编译器的其它一切。
UMD:UMD 版本可以通过
基本
文件
流程
错误
SQL
调试
- 请求信息 : 2026-06-05 23:25:08 HTTP/1.1 GET : /article/poipod.html
- 运行时间 : 2.1324s ( Load:0.0082s Init:1.3644s Exec:0.7504s Template:0.0093s )
- 吞吐率 : 0.47req/s
- 内存开销 : 2,235.02 kb
- 查询信息 : 12 queries 5 writes
- 文件加载 : 36
- 缓存信息 : 0 gets 0 writes
- 配置加载 : 130
- 会话信息 : SESSION_ID=c7a7257epeeuri623hior41jd5
- /www/wwwroot/tsicrk.com/index.php ( 1.09 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/ThinkPHP.php ( 4.61 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Think.class.php ( 12.26 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Storage.class.php ( 1.37 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Storage/Driver/File.class.php ( 3.52 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Mode/common.php ( 2.82 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Common/functions.php ( 53.56 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Hook.class.php ( 4.01 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/App.class.php ( 13.49 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Dispatcher.class.php ( 14.79 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Route.class.php ( 13.36 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Controller.class.php ( 11.23 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/View.class.php ( 7.59 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php ( 3.68 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php ( 3.88 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php ( 1.91 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Conf/convention.php ( 11.15 KB )
- /www/wwwroot/tsicrk.com/App/Common/Conf/config.php ( 2.14 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Lang/zh-cn.php ( 2.55 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Conf/debug.php ( 1.49 KB )
- /www/wwwroot/tsicrk.com/App/Home/Conf/config.php ( 0.31 KB )
- /www/wwwroot/tsicrk.com/App/Home/Common/function.php ( 3.33 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php ( 5.62 KB )
- /www/wwwroot/tsicrk.com/App/Home/Controller/ArticleController.class.php ( 6.02 KB )
- /www/wwwroot/tsicrk.com/App/Home/Controller/CommController.class.php ( 1.60 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Model.class.php ( 60.11 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Db.class.php ( 32.43 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Db/Driver/Pdo.class.php ( 16.74 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Cache.class.php ( 3.83 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Cache/Driver/File.class.php ( 5.87 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Template.class.php ( 28.16 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Template/TagLib/Cx.class.php ( 22.40 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Template/TagLib.class.php ( 9.16 KB )
- /www/wwwroot/tsicrk.com/App/Runtime/Cache/Home/7540f392f42b28b481b30614275e4e55.php ( 17.71 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php ( 0.97 KB )
- /www/wwwroot/tsicrk.com/ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php ( 5.24 KB )
- [ app_init ] --START--
- Run Behavior\BuildLiteBehavior [ RunTime:0.000005s ]
- [ app_init ] --END-- [ RunTime:0.000029s ]
- [ app_begin ] --START--
- Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000316s ]
- [ app_begin ] --END-- [ RunTime:0.000340s ]
- [ view_parse ] --START--
- [ template_filter ] --START--
- Run Behavior\ContentReplaceBehavior [ RunTime:0.000056s ]
- [ template_filter ] --END-- [ RunTime:0.000077s ]
- Run Behavior\ParseTemplateBehavior [ RunTime:0.006340s ]
- [ view_parse ] --END-- [ RunTime:0.006366s ]
- [ view_filter ] --START--
- Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000156s ]
- [ view_filter ] --END-- [ RunTime:0.000169s ]
- [ app_end ] --START--
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`pid`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( pid= )
- [8] Undefined index: pid /www/wwwroot/tsicrk.com/App/Home/Controller/ArticleController.class.php 第 47 行.
- [8] Undefined index: db_host /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Db.class.php 第 120 行.
- [8] Undefined index: db_port /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Db.class.php 第 121 行.
- [8] Undefined index: db_name /www/wwwroot/tsicrk.com/ThinkPHP/Library/Think/Db.class.php 第 122 行.

2.1324s
