{"id":14976370,"url":"https://github.com/detachment/build-vue-hackernews-2.0-from-scratch","last_synced_at":"2025-10-27T20:31:11.345Z","repository":{"id":92755815,"uuid":"78385923","full_name":"Detachment/Build-vue-hackernews-2.0-from-scratch","owner":"Detachment","description":"A tutorial for beginners to build a complex project with Vue.js 2.0 step by step","archived":false,"fork":false,"pushed_at":"2023-01-19T06:10:17.000Z","size":42099,"stargazers_count":89,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-01T08:02:26.815Z","etag":null,"topics":["javascript","vue-router","vuejs2","vuex2","webpack2"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Detachment.png","metadata":{"files":{"readme":"README.cn.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-09T02:19:58.000Z","updated_at":"2024-10-15T16:59:32.000Z","dependencies_parsed_at":"2023-04-28T12:54:20.396Z","dependency_job_id":null,"html_url":"https://github.com/Detachment/Build-vue-hackernews-2.0-from-scratch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detachment%2FBuild-vue-hackernews-2.0-from-scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detachment%2FBuild-vue-hackernews-2.0-from-scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detachment%2FBuild-vue-hackernews-2.0-from-scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detachment%2FBuild-vue-hackernews-2.0-from-scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Detachment","download_url":"https://codeload.github.com/Detachment/Build-vue-hackernews-2.0-from-scratch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238553046,"owners_count":19491367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","vue-router","vuejs2","vuex2","webpack2"],"created_at":"2024-09-24T13:53:47.483Z","updated_at":"2025-10-27T20:31:08.774Z","avatar_url":"https://github.com/Detachment.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 从零开始搭建 《vue-hackernews-2.0》\n\n## 前言 [ [English Version](./README.md) ]\n\n欢迎大家来到我的第一个程序搭建教程: **从零开始搭建 《vue-hackernews-2.0》**。\n\n作为一个前端开发的初学者，在接触学习到 Vue.js 的时候，我发现官方提供并极力推荐的项目《vue-hackernews-2.0》对于新手而言比较难理解。但同时我又被这种高度工业化的项目所吸引，所以我决定花一段时间来弄清楚这个项目到底是怎么运行起来的。 在这个教程中我将会通过利用不同的版本的迭代的方式来逐步重建这个项目。\n\n**这个项目是面向初学者的。** 整个教程中，我逐步实现了这个项目的四个版本，每一个版本之间有一定的递进关系。为了方便理解掌握每个版本的内容，在每个版本的说明中，我会尽量把在相应版本中所需要掌握的知识点列出来。\n\n\u003e 注明：简便起见，如未特别说明，在之后的所有章节中我会用 Vue-HN 来代替 vue-hackernews-2.0 项目。 项目运行的系统是 Windows 7，因条件限制未在其他系统上测试，请见谅。\n\n\n## 各版本简介\n### 0. Vue.js, Vuex, Vue-router, HN API, Firebase, ES6\n作为一个前端初学者，我对最原始的页面构造比较熟悉，也就是页面只由 HTML、CSS 以及 JavaScript 构成。所以自从我开始学习 Vue-HN 这个项目我就想是不是可以用最原始的方法来实现这个项目（当然，不考虑用户体验及性能等方面）。在经过多次失败的尝试之后，我终于只利用 Vue.js 及其生态中的一些库实现了这个版本。下面这两个动图就分别是我这个版本和官方版本。\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./tutorials/0-vue.js-vuex-router/img/Author.gif\" width=\"700px\" alt=\"Origin Website\"\u003e\n    \u003cbr/\u003e\n    [ 我的版本 ]\n    \u003cbr/\u003e\n    \u003cbr/\u003e\n    \u003cimg src=\"./tutorials/0-vue.js-vuex-router//img/Mine.gif\" width=\"700px\" alt=\"Plane Vue.js\"\u003e\n    \u003cbr/\u003e\n    [ 官方版本 ]\n\u003c/p\u003e\n\n### 1. Webpack, Vue.js, Vue-router, Vuex and Hackernews API\n经过第一个版本后，我们对这个项目有了初步的了解。在这个版本中，我们会使用一些工具，使得我们这个项目初步模块化，同时也更加便于维护。我们将会使用到一些基本的插件和包，并通过 webpack 来实现功能。我们只需要简单的配置一下 webpack 就行，不会涉及到服务器端的内容，不会涉及缓存也不会涉及生产模式及开发模式的不同配置。下面的动图就是这个版本的成品，同时这个动图里面还包含了对整个项目的简单解构。\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./tutorials/1-webpack-vue.js-router-store-firebase/public/first_edition.gif\" width=\"700px\" alt=\"Basic functions and simple deconstruction\" \u003e\n    \u003cbr/\u003e\n    [ 基本功能及简单解构 ]\n\u003c/p\u003e\n\n### 2. Server, Packages and Plugins for Better Performance\n于我而言，这个版本是整个项目中最难的一个版本。为了优化用户体验，原作者将很多因素考虑在内，这就会带来很多需要了解的新知识，比如 node.js 中的 express 框架以及各种插件。服务器端及客户端、生产模式及调试模式的不同配置是这个版本的重点。在接下来的片段中，我会将我所理解的部分分享给大家。\n由于这个版本和[官网](https://vue-hn.now.sh/top)的一样，我就不上效果图了。\n\n### 3. Change the Project as I like\n在这个版本中，我将会根据自己的喜好对整个网页进行一些改造，使得网页整体更具有 Vue.js 风格，至少从视觉上来说更加的 Vue.js。下面的动图可以预览到我这个版本的成品，为了对照官方例子，你可以去[官网](https://vue-hn.now.sh/top)查看原网页。对于所添加及更改的部分，本节的下半部分将会详细介绍。\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./tutorials/3-Change-the-Project-as-I-like/public/last-edition-resize.gif\" width=\"700px\" alt=\"Last Edition of Vue-HackerNews\" \u003e\n    \u003cbr/\u003e\n    [ Vue-HackerNews 最后版本 ]\n\u003c/p\u003e\n\n\n\n## 目录\n\n[0-vue.js-vuex-router-firebase-ES6](/tutorials/0-vue.js-vuex-router/README.cn.md)   \n[1-webpack-vue.js-router-store-firebase](/tutorials/1-webpack-vue.js-router-store-firebase/README.cn.md)    \n[2-Packages-Plugins-for-Better-User-Experience](/tutorials/2-Packages-Plugins-for-Better-User-Experience/README.cn.md)  \n[3-Change-the-Project-as-I-like](/tutorials/3-Change-the-Project-as-I-like/README.cn.md)\n\n\n## License\nCopyright (c) 2017 Copyright Holder All Rights Reserved.  \nMIT (http://opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetachment%2Fbuild-vue-hackernews-2.0-from-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetachment%2Fbuild-vue-hackernews-2.0-from-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetachment%2Fbuild-vue-hackernews-2.0-from-scratch/lists"}