-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
8,151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true | ||
}, | ||
parserOptions: { | ||
parser: 'babel-eslint' | ||
}, | ||
extends: [ | ||
'plugin:vue/recommended', | ||
'plugin:prettier/recommended' | ||
], | ||
// required to lint *.vue files | ||
plugins: [ | ||
'vue', | ||
'prettier' | ||
], | ||
// add your custom rules here | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Node template | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# Nuxt generate | ||
dist | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
# IDE | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,102 @@ | ||
# duoduo-cashier | ||
# [duoduo-cashier](https://github.com/YunYouJun/duoduo-cashier) | ||
|
||
Record work income | ||
|
||
## Intend | ||
|
||
做一个记账小程序 | ||
|
||
- 账号系统 | ||
- 图表显示变化 | ||
- 增删改查 | ||
- [PWA](https://pwa.nuxtjs.org/) | ||
|
||
## Base | ||
|
||
### 底层框架 | ||
|
||
- [Vue](https://cn.vuejs.org/) | ||
|
||
### 应用框架 | ||
|
||
- [Nuxt](https://zh.nuxtjs.org/) | ||
|
||
### UI框架 | ||
|
||
- [Element UI](https://github.com/ElemeFE/element) | ||
|
||
#### Chart | ||
|
||
- [Chart.js](https://github.com/chartjs/Chart.js) | ||
- [vue-chartjs](https://github.com/apertureless/vue-chartjs) | ||
|
||
### 后台数据库 | ||
|
||
- [Leancloud](https://leancloud.cn/) | ||
|
||
## 前言 | ||
|
||
唔,没什么可说的。 | ||
|
||
写给没什么网站开发基础的多多同学。 | ||
|
||
## 古往今来 | ||
|
||
首先,开发一个网站,有多种开发方式。 | ||
在远古时代,网页常常是通过编写 [Html](https://developer.mozilla.org/zh-CN/docs/Web/HTML) 标签元素(如 `<p></p>`), | ||
并拼凑起来展示网页的内容。 | ||
后来有了 [Css](https://developer.mozilla.org/zh-CN/docs/Web/CSS) 来控制网页地布局, | ||
再后来又有了 [JavaScript](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript), | ||
可以实现与用户之间的交互和一些计算。 | ||
譬如点击按钮后,让网页的某部分内容发生变化,样式发生改变等等等等。 | ||
所以 Html + Css + JavaScript 成为了开发网页必备的三剑客。 | ||
这些都可以在 [Mozilla](https://developer.mozilla.org/) 中更加深入地了解,在此略过不表。 | ||
|
||
后来 [jQuery](https://jquery.com/) 横空出世,几乎一统江湖。那么 jQuery 又是什么? | ||
jQuery 名中含有一个 j, Query 则是查询的意思。顾名思义,jQuery 是由 JavaScript 编写的一个库。 | ||
用来更加快速地查找出 Html 文档中的标签元素,并操纵它。这也大大提高了前端开发的效率。 | ||
|
||
但天下大势,分久必合,合久必分。为了克服 HTML 在构建应用上的不足,由谷歌开发的 [Angualar](https://github.com/angular/angular) 诞生(2009)。相比 jQuery 而言,是一种更完备的 Web 应用开发的解决方案。 | ||
后来 Facebook 对市场上所有 JavaScript MVC 框架都不满意,就决定自己写一套。 | ||
[React](https://github.com/facebook/react/) 就此诞生,并于 2013 年 5 月开源。 | ||
而 Vue 的第一个 [Commit](https://github.com/vuejs/vue/commit/83fac017f96f34c92c3578796a7ddb443d4e1f17) 可追溯至 2013 年 7 月 28 日,此后势如破竹,并于去年成功超过 React 在 Github 上的 Star 数。成为目前 GitHub 上最受欢迎的前端框架。 | ||
Angular/React/Vue 三足鼎立之势业已形成。 | ||
|
||
## 开始 | ||
|
||
Vue.js 与 jQuery 不同,jQuery 操纵 DOM ((文档对象模型(Document Object Model)),譬如一个标签就是一个对象模型), | ||
而 Vue 则由数据驱动,当数据发生改变时,再更新视图,并不直接操纵 DOM 。 | ||
|
||
说了这么多,本项目决定采用 Nuxt.js 来开发,Nuxt 正是基于 Vue.js 的通用应用框架。 | ||
好处就是,它可以提供一个良好的模板结构,以及服务端渲染、异步数据加载、中间件支持等等许多特性。 | ||
这些特性,通过 Vue 相关的插件与配置同样可以从零实现,而 Nuxt 则将其集成在一起,可以帮我们省去许多的工作。 | ||
|
||
项目地址: <https://github.com/YunYouJun/duoduo-cashier> | ||
|
||
### 安装 Nuxt | ||
|
||
可参考 [Nuxt 文档](https://zh.nuxtjs.org/guide/installation/) | ||
|
||
运行 create-nuxt-app | ||
|
||
此处我使用 [yarn](https://www.yarnpkg.com/zh-Hans/) | ||
|
||
```sh | ||
yarn create nuxt-app duoduo-cashier | ||
``` | ||
|
||
默认服务器为 None,因为后台打算使用 LeanCloud ,一是需求小可以使用开发版免费,二则无需额外搭建后台服务器。 | ||
|
||
UI 框架选择了 [Element-UI](https://github.com/ElemeFE/element) ,因为过去经常使用,较为熟悉,且 Github 上星数最多,经常维护。 | ||
|
||
选择 SPA[single page web application] 模式,旨在开发单页应用,即只有一张Web页面的应用,当进行交互时,动态更新页面视图,也是现在较为流行的模式。 | ||
|
||
进入文件夹,启动项目 | ||
|
||
```sh | ||
cd duoduo-cashier | ||
yarn dev | ||
``` | ||
|
||
目录结构及各文件夹用途可参见[此处文档](https://zh.nuxtjs.org/guide/directory-structure) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ASSETS | ||
|
||
**This directory is not required, you can delete it if you don't want to use it.** | ||
|
||
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. | ||
|
||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div class="VueToNuxtLogo"> | ||
<div class="Triangle Triangle--two"/> | ||
<div class="Triangle Triangle--one"/> | ||
<div class="Triangle Triangle--three"/> | ||
<div class="Triangle Triangle--four"/> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.VueToNuxtLogo { | ||
display: inline-block; | ||
animation: turn 2s linear forwards 1s; | ||
transform: rotateX(180deg); | ||
position: relative; | ||
overflow: hidden; | ||
height: 180px; | ||
width: 245px; | ||
} | ||
.Triangle { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
.Triangle--one { | ||
border-left: 105px solid transparent; | ||
border-right: 105px solid transparent; | ||
border-bottom: 180px solid #41b883; | ||
} | ||
.Triangle--two { | ||
top: 30px; | ||
left: 35px; | ||
animation: goright 0.5s linear forwards 3.5s; | ||
border-left: 87.5px solid transparent; | ||
border-right: 87.5px solid transparent; | ||
border-bottom: 150px solid #3b8070; | ||
} | ||
.Triangle--three { | ||
top: 60px; | ||
left: 35px; | ||
animation: goright 0.5s linear forwards 3.5s; | ||
border-left: 70px solid transparent; | ||
border-right: 70px solid transparent; | ||
border-bottom: 120px solid #35495e; | ||
} | ||
.Triangle--four { | ||
top: 120px; | ||
left: 70px; | ||
animation: godown 0.5s linear forwards 3s; | ||
border-left: 35px solid transparent; | ||
border-right: 35px solid transparent; | ||
border-bottom: 60px solid #fff; | ||
} | ||
@keyframes turn { | ||
100% { | ||
transform: rotateX(0deg); | ||
} | ||
} | ||
@keyframes godown { | ||
100% { | ||
top: 180px; | ||
} | ||
} | ||
@keyframes goright { | ||
100% { | ||
left: 70px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# COMPONENTS | ||
|
||
**This directory is not required, you can delete it if you don't want to use it.** | ||
|
||
The components directory contains your Vue.js Components. | ||
|
||
_Nuxt.js doesn't supercharge these components._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# LAYOUTS | ||
|
||
**This directory is not required, you can delete it if you don't want to use it.** | ||
|
||
This directory contains your Application Layouts. | ||
|
||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<div> | ||
<nuxt/> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
html { | ||
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', | ||
Roboto, 'Helvetica Neue', Arial, sans-serif; | ||
font-size: 16px; | ||
word-spacing: 1px; | ||
-ms-text-size-adjust: 100%; | ||
-webkit-text-size-adjust: 100%; | ||
-moz-osx-font-smoothing: grayscale; | ||
-webkit-font-smoothing: antialiased; | ||
box-sizing: border-box; | ||
} | ||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: border-box; | ||
margin: 0; | ||
} | ||
.button--green { | ||
display: inline-block; | ||
border-radius: 4px; | ||
border: 1px solid #3b8070; | ||
color: #3b8070; | ||
text-decoration: none; | ||
padding: 10px 30px; | ||
} | ||
.button--green:hover { | ||
color: #fff; | ||
background-color: #3b8070; | ||
} | ||
.button--grey { | ||
display: inline-block; | ||
border-radius: 4px; | ||
border: 1px solid #35495e; | ||
color: #35495e; | ||
text-decoration: none; | ||
padding: 10px 30px; | ||
margin-left: 15px; | ||
} | ||
.button--grey:hover { | ||
color: #fff; | ||
background-color: #35495e; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# MIDDLEWARE | ||
|
||
**This directory is not required, you can delete it if you don't want to use it.** | ||
|
||
This directory contains your application middleware. | ||
The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts). | ||
|
||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). |
Oops, something went wrong.