diff --git a/.gitignore b/.gitignore index 6fb199d..10b7057 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +#file public node_modules yarn.lock diff --git a/public/Amani-间奏-1.html b/public/Amani-间奏-1.html index 5cf7de5..2fc0937 100644 --- a/public/Amani-间奏-1.html +++ b/public/Amani-间奏-1.html @@ -652,7 +652,7 @@ @@ -672,7 +672,7 @@ @@ -734,7 +734,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/GIT使用攻略.html b/public/GIT使用攻略.html index 90f87e8..29f61e5 100644 --- a/public/GIT使用攻略.html +++ b/public/GIT使用攻略.html @@ -649,7 +649,7 @@ ls @@ -1253,7 +1258,7 @@ @@ -1273,7 +1278,7 @@ @@ -1335,7 +1340,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/js中的一些方法和函数.html b/public/js中的一些方法和函数.html index c85c7db..fc9fd11 100644 --- a/public/js中的一些方法和函数.html +++ b/public/js中的一些方法和函数.html @@ -779,7 +779,7 @@ if (isIE){ @@ -799,7 +799,7 @@ if (isIE){ @@ -861,7 +861,7 @@ if (isIE){
  • 文章总数 - 57 + 61
  • diff --git a/public/learn-express.html b/public/learn-express.html index 7b55564..eb0402e 100644 --- a/public/learn-express.html +++ b/public/learn-express.html @@ -784,7 +784,7 @@ img.src = base64Data; @@ -804,7 +804,7 @@ img.src = base64Data; @@ -866,7 +866,7 @@ img.src = base64Data;
  • 文章总数 - 57 + 61
  • diff --git a/public/learn-koa.html b/public/learn-koa.html index 934810e..ef10718 100644 --- a/public/learn-koa.html +++ b/public/learn-koa.html @@ -653,7 +653,7 @@ @@ -673,7 +673,7 @@ @@ -735,7 +735,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/links/index.html b/public/links/index.html index 1dcc30b..df08515 100644 --- a/public/links/index.html +++ b/public/links/index.html @@ -493,7 +493,7 @@ @@ -513,7 +513,7 @@ @@ -575,7 +575,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/material主题使用攻略.html b/public/material主题使用攻略.html index 87721ea..c1ac296 100644 --- a/public/material主题使用攻略.html +++ b/public/material主题使用攻略.html @@ -771,7 +771,7 @@ layout: tags @@ -791,7 +791,7 @@ layout: tags @@ -853,7 +853,7 @@ layout: tags
  • 文章总数 - 57 + 61
  • diff --git a/public/page/2/index.html b/public/page/2/index.html index f067795..e3513e4 100644 --- a/public/page/2/index.html +++ b/public/page/2/index.html @@ -422,6 +422,245 @@ + +
    + + + + +
    + + + + +

    redis环境搭建

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 3月 07, 2018 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    你的一生,究竟为什么而活

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 2月 11, 2018 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    JS常见的十大错误

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 2月 07, 2018 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    深入浅出 Ajax

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 1月 31, 2018 +
    +
    +
    + + + + + + + + + +
    +
    +
    + + + + + + +
    @@ -786,255 +1025,11 @@ - - - -
    - - - - -
    - - - - -

    vscode 配置插件推荐

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 12月 26, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    learn express

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 12月 20, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    urlMaker

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 12月 18, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    我个人的coding风格

    -
    - - -
    - - 我一直在探索属于我自己独一无二的代码风格... - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 11月 26, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - @@ -1137,7 +1132,7 @@ @@ -1157,7 +1152,7 @@ @@ -1219,7 +1214,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/page/3/index.html b/public/page/3/index.html index 14fad07..0c0a592 100644 --- a/public/page/3/index.html +++ b/public/page/3/index.html @@ -422,6 +422,250 @@ + +
    + + + + +
    + + + + +

    vscode 配置插件推荐

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 12月 26, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    learn express

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 12月 20, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    urlMaker

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 12月 18, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    我个人的coding风格

    +
    + + +
    + + 我一直在探索属于我自己独一无二的代码风格... + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 11月 26, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + +
    @@ -786,257 +1030,11 @@ - - - -
    - - - - -
    - - - - -

    learn-koa

    -
    - - -
    - - app.use() - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 9月 06, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    如何成为一名合格的CEO

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 8月 28, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    前端面试准备

    -
    - - -
    - - 整理一些面试题,以备用 - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 8月 27, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    commonJS和AMD/CMD

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 8月 23, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - @@ -1139,7 +1137,7 @@ @@ -1159,7 +1157,7 @@ @@ -1221,7 +1219,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/page/4/index.html b/public/page/4/index.html index 593483e..9177ab9 100644 --- a/public/page/4/index.html +++ b/public/page/4/index.html @@ -422,6 +422,252 @@ + +
    + + + + +
    + + + + +

    learn-koa

    +
    + + +
    + + app.use() + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 9月 06, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    如何成为一名合格的CEO

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 8月 28, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    前端面试准备

    +
    + + +
    + + 整理一些面试题,以备用 + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 8月 27, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    commonJS和AMD/CMD

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 8月 23, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + +
    @@ -781,255 +1027,11 @@ - - - -
    - - - - -
    - - - - -

    css的命名规范

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 7月 17, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    vue-eleme

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 7月 05, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    sticky-footer

    -
    - - -
    - - 今天,我想讲讲关于stick-footer布局技... - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 7月 02, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    我向往的明天

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 7月 01, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - @@ -1132,7 +1134,7 @@ @@ -1152,7 +1154,7 @@ @@ -1214,7 +1216,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/page/5/index.html b/public/page/5/index.html index 9fd92e1..145c29b 100644 --- a/public/page/5/index.html +++ b/public/page/5/index.html @@ -422,6 +422,250 @@ + +
    + + + + +
    + + + + +

    css的命名规范

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 7月 17, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    vue-eleme

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 7月 05, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    sticky-footer

    +
    + + +
    + + 今天,我想讲讲关于stick-footer布局技... + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 7月 02, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + +
    + + + + +

    我向往的明天

    +
    + + +
    + + + +     + + 阅读全文 + +
    + +
    +
    + +
    + Jzxer's avatar +
    +
    + Jzxer + 7月 01, 2017 +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    + + + + + + +
    @@ -787,196 +1031,11 @@ - - - -
    - - - - -
    - - - - -

    vuex 使用技巧

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 6月 15, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - -
    - - - - -
    - - - - -

    git使用技巧

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 4月 15, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - - - - -
    - - - - -
    - - - - -

    Amani-间奏

    -
    - - -
    - - - -     - - 阅读全文 - -
    - -
    -
    - -
    - Jzxer's avatar -
    -
    - Jzxer - 3月 28, 2017 -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - - - - - @@ -1079,7 +1138,7 @@ @@ -1099,7 +1158,7 @@ @@ -1161,7 +1220,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/search.xml b/public/search.xml index d7229a9..b42d0e6 100644 --- a/public/search.xml +++ b/public/search.xml @@ -2,6 +2,240 @@ + + <![CDATA[cookie和session]]> + /cookie%E5%92%8Csession.html +

    介绍

    cookie 是 HTTP 协议的一部分,处理分为以下几步:

    +
      +
    1. 服务器向客户端发送 cookie,一般为 name=value 形式。

      +
    2. +
    3. 浏览器将 cookie 储存。

      +
    4. +
    5. 每次请求浏览器都会将 cookie 发给服务器。

      +
    6. +
    +
    res.cookie('isVisit', 1, {
    +  // 储存的时间
    +  maxAge: 10 * 1000,
    +  // 为 true 时只在https中生效
    +  secure: true,
    +  // 影响路径
    +  path: 'localhost',
    +  // 是否支持 js 读取,可以预防 XSS
    +  httpOnly: true
    +})
    +
    +
    +

    isVisit 是 key 值,1 是 value。

    +
    +

    数据在客户端就可以被修改,数据很容易被伪造,而且数据太多会影响传输效率。

    +

    session

    针对 cookie 的缺点,session 解决了这些问题,session 保存在服务端,它的运作是通过 session_id 进行,这个值一般存在客户端的 cookie 中。

    +

    session 属性

    app.use(sessionParser({
    +  name: 'author',
    +  // 储存位置: 默认 cookie
    +  // store: new redisStore(),
    +  // 编码字符串
    +  secret: 'recommand 128 bytes random string',
    +  cookie: {
    +    maxAge: 60 * 1000
    +  },
    +  //每次请求都重设一个cookie
    +  rolling: false,
    +  resave: true,
    +  // 是指无论有没有session cookie,每次请求都设置个session cookie ,默认给个标示为 connect.sid
    +  saveUninitialized: false
    +}))
    +
    +

    signedCookie

    就是签名,专业点就是 “信息摘要算法“,例如我有一些数据想存在 cookie 中,如何保证不被篡改?

    +

    比如我们用 dotcom_user 字段设置了个值 jzxer, cookie值应该是:

    +
    > { dotcom_user: 'jzxer' }
    +
    +

    这样如果验证和更改,安全性都不是很高。

    +

    我们可以这样处理,设置一个 secrit_string 和 dotcom_user 做个算法(不同的账户签名不同)

    +
    +

    sha1(secrit_string + dotcom_user) === ‘4850a42e3bc0d39c978770392cbd8dc2923e3d1d’

    +
    +

    然后把 cookie 变成这样:

    +
    {
    +  dotcom_user: 'jzxer',
    +  dotcom_user.sig: '4850a42e3bc0d39c978770392cbd8dc2923e3d1d'
    +}
    +
    +

    这样一来信息就无法伪造了,一旦更改了 cookie 中的值,就会和服务器的冲突,破解的成本也太高。

    +]]>
    + + + + 本地储存 + + + + + + + cookie + + session + + + +
    + + + <![CDATA[线上部署:heroku]]> + /%E7%BA%BF%E4%B8%8A%E9%83%A8%E7%BD%B2%EF%BC%9Aheroku.html +

    介绍

    heroku 是一个自动部署工具,可以在代码发布后马上线上跑起来,对于一个刚入门的 node 新手有利于促进你的开发热情。

    +

    1. 注册一个账号

    heroku

    +
    +

    注意邮箱项目可以填写阿里云邮箱,目前qq邮箱和163邮箱不支持注册。

    +
    +

    2. 配置文件:Procfile

    给 heroku 指明入口文件,配置内容如下:

    +
    web: node app.js
    +
    +

    3. 下载工具包

    下载链接

    +

    4. 登录账户

    heroku login
    +
    +

    5. 创建远程仓库

    heroku create
    +
    +
    +

    此时会给出一个仓库地址,留给下文用。

    +
    +

    6. 推送到远端

    git push '给的仓库地址.git' master
    +
    +

    7. 测试项目

    输入以下命令打开推送的内容

    +
    heroku open
    +
    +

    8. 插件

    heroku 有很多插件可供链接,

    +]]>
    + + + + nodeJS + + + + + + + heroku + + 自动化 + + + +
    + + + <![CDATA[nginx配置和问题处理]]> + /nginx%E9%85%8D%E7%BD%AE%E5%92%8C%E9%97%AE%E9%A2%98%E5%A4%84%E7%90%86.html +

    nginx 介绍

    Nginx (“engine x”) 是一个高性能的 HTTP 和 反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。

    +

    尽管Node.JS的性能不错,但处理静态事务确实不是他的专长,如:gzip编码,静态文件,HTTP缓存,SSL处理,负载平衡和反向代理及多站点代理等,都可以通过nginx来完成,从而减小node.js的负载,并通过nginx强大的缓存来节省您网站的流量从而提高网站的加载速度。

    +

    查看 nginx 进程

    ps aux|grep nginx
    +
    +

    nginx.conf 配置

    server {
    +                listen       3001;
    +                server_name  localhost;
    +
    +                #charset koi8-r;
    +
    +                #access_log  logs/host.access.log  main;
    +
    +                location / {
    +                        root   html;
    +                        index  index.html index.htm;
    +                }
    +        }
    +
    +
    +

    大约 36 行的位置,端口号可以设置其他,最好不要用80,设置好之后重启。

    +
    +

    nginx 问题总结

    ubuntu 下卸载不干净

    sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。
    +
    +sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。
    +
    +sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。
    +
    +sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包。
    +
    +sudo service nginx restart  #重启nginx
    +
    +]]>
    + + + + 代理 + + + + + + + nginx + + + +
    + + + <![CDATA[nodeJS性能处理(一)]]> + /nodeJS%E6%80%A7%E8%83%BD%E5%A4%84%E7%90%86%E4%B8%80.html +

    介绍

    目前市面上有很多后台纯 node 的项目,但是用 node 做后端还是有一系列的问题,比如稳定性,安全性,抛开这两块还要优化性能,如何提高用户的访问速度,在网络不佳(2G)的情况下如何能正常访问项目,都是一系列需要考虑的问题。本章内容针对安全性给出相关技巧。

    +

    1. 不要用 Eval

    eval 的作用是将用户输入的字符串转化为可执行的代码,类似欺骗的效果,这样的坏处是会受到 XSS 攻击。

    +

    2. 使用 strict 模式

    严格模式下的变量声明会抛出一些隐藏的错误。

    +
    'use strict'
    +var obj = {
    +  a: '1',
    +  a: '2'
    +}
    +// 抛出错误 syntax error
    +
    +

    3. 使用 Eslint 测试代码规范

    可以使我们早期捕获一些 bug,并及时修正。

    +

    4. 全面测试

    测试很重要,不但单元要测试,还要全面测试,例如用 mocha 测试代码覆盖率。

    +

    5. Unix 下不要直接使用 sudo node app.js

    这样如果产生错误,会让整个系统宕机,可以使用 nginx 反向代理。

    +

    6. 避免 shell command 注入

    child_process.exec('ls', function (err, data) {
    +    console.log(data);
    +});
    +
    +

    上面的 child_process.exec 调用的是 /bin/sh ,也就是执行了一个解释器。

    +
    +

    为了避免这个问题,我们可以使用:child_process.execFile。

    +
    +

    7. 临时文件

    创建文件时,处理上传的文件要注意,这些文件可能会吃掉你的磁盘所有空间。

    +
    +

    使用 Streams。

    +
    +

    8. 加密 Web 应用

    用 https 代替 http,请求的过程可以添加签名头。

    +

    9. Reflected Cross Site Scripting

    也就是跨站脚本攻击,就是但用户发送一段数据,如果在未做任何处理的情况下直接插入 DOM,这可能会出现安全问题,例如:

    +
    //用户输入的数据中带脚本,如果不做处理,会被执行。
    +Im human <script>alert('I‘m hacker')<script>
    +
    +
    +

    处理方式:1. 对插入的数据进行验证,除去 HTML。

    +
    +

    默认情况下,cookie 可以通过 js 在同一个域中读取,这就有可能会被跨站点脚本攻击,而且可能被第三方库读取。为了处理这种情况,我们可以在 cookies 上使用 HTTPOnly,这个标签可以让 js 无法读取。

    +

    11. 内容安全策略(CSP)

    附加的安全层,可以检测和缓解某类攻击,例如:XSS、数据注入。启用方法如下:

    +
    Content-Security-Policy: default-src 'self' *.mydomain.com
    +
    +

    12. Cross-Site Request Forgery

    跨站请求伪造是一种迫使终端用户在他目前已验证授权的Web应用程序中执行其它的actions。node 社区已实现,可以使用同步令牌模式处理。

    +]]>
    + + + + nodeJS + + + + + + + 性能 + + 安全 + + + +
    + <![CDATA[node连接阿里云redis]]> /node%E8%BF%9E%E6%8E%A5%E9%98%BF%E9%87%8C%E4%BA%91redis.html @@ -3191,45 +3425,6 @@ $ hexo deploy - - <![CDATA[vuex 使用技巧]]> - /vuex-%E6%A8%A1%E5%9D%97%E4%BB%8B%E7%BB%8D.html -

    Action

    提供方法和API请求,类似于mutation

    -
    -

    mutation 修改 state 只能是同步的

    -
      -
    • action 充满了各种异步 api
      actions: {
      -  increment (context) {
      -      context.commit('increment')
      - }
      -}
      -另一种写法
      -increment({commit}) {
      -  commit('increment')
      -}
      -
    • -
    -
    -

    分发 Action

    -

    store.dispatch(‘increment’)

    -
    -]]>
    - - - - vue - - - - - - - vuex - - - -
    - <![CDATA[vue高仿qq音乐官网]]> /vue%E9%AB%98%E4%BB%BFqq%E9%9F%B3%E4%B9%90%E5%AE%98%E7%BD%91.html @@ -3345,6 +3540,45 @@ npm run start + + <![CDATA[vuex 使用技巧]]> + /vuex-%E6%A8%A1%E5%9D%97%E4%BB%8B%E7%BB%8D.html +

    Action

    提供方法和API请求,类似于mutation

    +
    +

    mutation 修改 state 只能是同步的

    +
      +
    • action 充满了各种异步 api
      actions: {
      +  increment (context) {
      +      context.commit('increment')
      + }
      +}
      +另一种写法
      +increment({commit}) {
      +  commit('increment')
      +}
      +
    • +
    +
    +

    分发 Action

    +

    store.dispatch(‘increment’)

    +
    +]]>
    + + + + vue + + + + + + + vuex + + + +
    + <![CDATA[git使用技巧]]> /GIT%E4%BD%BF%E7%94%A8%E6%94%BB%E7%95%A5.html @@ -3980,8 +4214,8 @@ layout: tags - <![CDATA[tags]]> - /tags/index.html + <![CDATA[links]]> + /links/index.html ]]> @@ -3992,8 +4226,8 @@ layout: tags - <![CDATA[links]]> - /links/index.html + <![CDATA[tags]]> + /tags/index.html ]]> diff --git a/public/sessionStorage-localStotage-AND-cookies.html b/public/sessionStorage-localStotage-AND-cookies.html index 4cf5afe..c7f6569 100644 --- a/public/sessionStorage-localStotage-AND-cookies.html +++ b/public/sessionStorage-localStotage-AND-cookies.html @@ -690,7 +690,7 @@ @@ -710,7 +710,7 @@ @@ -772,7 +772,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/simpleCountry.html b/public/simpleCountry.html index f85e33c..65aa359 100644 --- a/public/simpleCountry.html +++ b/public/simpleCountry.html @@ -673,7 +673,7 @@ @@ -693,7 +693,7 @@ @@ -755,7 +755,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/sticky-footer.html b/public/sticky-footer.html index c1f14be..3c14311 100644 --- a/public/sticky-footer.html +++ b/public/sticky-footer.html @@ -777,7 +777,7 @@ body { @@ -797,7 +797,7 @@ body { @@ -859,7 +859,7 @@ body {
  • 文章总数 - 57 + 61
  • diff --git a/public/sync-和async.html b/public/sync-和async.html index e960cc9..63f45f9 100644 --- a/public/sync-和async.html +++ b/public/sync-和async.html @@ -664,7 +664,7 @@ @@ -684,7 +684,7 @@ @@ -746,7 +746,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/CStyle/index.html b/public/tags/CStyle/index.html index b481929..a5ca0fb 100644 --- a/public/tags/CStyle/index.html +++ b/public/tags/CStyle/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/PWA/index.html b/public/tags/PWA/index.html index ad91c67..21ff0fd 100644 --- a/public/tags/PWA/index.html +++ b/public/tags/PWA/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/SC/index.html b/public/tags/SC/index.html index 5aff84c..4bd970d 100644 --- a/public/tags/SC/index.html +++ b/public/tags/SC/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/badBoy/index.html b/public/tags/badBoy/index.html index be6f9a0..2d4e2c4 100644 --- a/public/tags/badBoy/index.html +++ b/public/tags/badBoy/index.html @@ -580,7 +580,7 @@ @@ -600,7 +600,7 @@ @@ -662,7 +662,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/beyond/index.html b/public/tags/beyond/index.html index 930e5da..c8ecdac 100644 --- a/public/tags/beyond/index.html +++ b/public/tags/beyond/index.html @@ -646,7 +646,7 @@ @@ -666,7 +666,7 @@ @@ -728,7 +728,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/commonjs/index.html b/public/tags/commonjs/index.html index 6275f4e..59f384d 100644 --- a/public/tags/commonjs/index.html +++ b/public/tags/commonjs/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/cookies/index.html b/public/tags/cookies/index.html index bce956d..3906ffc 100644 --- a/public/tags/cookies/index.html +++ b/public/tags/cookies/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/css命名规范/index.html b/public/tags/css命名规范/index.html index 00565c6..0975847 100644 --- a/public/tags/css命名规范/index.html +++ b/public/tags/css命名规范/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/es6/index.html b/public/tags/es6/index.html index 8ff47a1..1470348 100644 --- a/public/tags/es6/index.html +++ b/public/tags/es6/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/express/index.html b/public/tags/express/index.html index 6006714..d3fe647 100644 --- a/public/tags/express/index.html +++ b/public/tags/express/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/git/index.html b/public/tags/git/index.html index 2812e68..b323fca 100644 --- a/public/tags/git/index.html +++ b/public/tags/git/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/hexo/index.html b/public/tags/hexo/index.html index 3670c4e..387979e 100644 --- a/public/tags/hexo/index.html +++ b/public/tags/hexo/index.html @@ -646,7 +646,7 @@ @@ -666,7 +666,7 @@ @@ -728,7 +728,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/hybird/index.html b/public/tags/hybird/index.html index 8f7a09b..2fa3838 100644 --- a/public/tags/hybird/index.html +++ b/public/tags/hybird/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/index.html b/public/tags/index.html index 8dd29eb..9e24435 100644 --- a/public/tags/index.html +++ b/public/tags/index.html @@ -327,7 +327,7 @@ @@ -428,7 +428,7 @@ @@ -448,7 +448,7 @@ @@ -510,7 +510,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/js-methods/index.html b/public/tags/js-methods/index.html index 4f0d269..8c8c62a 100644 --- a/public/tags/js-methods/index.html +++ b/public/tags/js-methods/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/js/index.html b/public/tags/js/index.html index 089bd99..a280620 100644 --- a/public/tags/js/index.html +++ b/public/tags/js/index.html @@ -646,7 +646,7 @@ @@ -666,7 +666,7 @@ @@ -728,7 +728,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/koa/index.html b/public/tags/koa/index.html index cc9e213..2999057 100644 --- a/public/tags/koa/index.html +++ b/public/tags/koa/index.html @@ -586,7 +586,7 @@ @@ -606,7 +606,7 @@ @@ -668,7 +668,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/localStotage/index.html b/public/tags/localStotage/index.html index 820440c..b988458 100644 --- a/public/tags/localStotage/index.html +++ b/public/tags/localStotage/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/mongoDB/index.html b/public/tags/mongoDB/index.html index 5c62c80..3fb6265 100644 --- a/public/tags/mongoDB/index.html +++ b/public/tags/mongoDB/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/nodeJS/index.html b/public/tags/nodeJS/index.html index 49977c4..ea29e55 100644 --- a/public/tags/nodeJS/index.html +++ b/public/tags/nodeJS/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/react/index.html b/public/tags/react/index.html index 0b6ee00..ca1f4fe 100644 --- a/public/tags/react/index.html +++ b/public/tags/react/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/rock/index.html b/public/tags/rock/index.html index 1594573..32da145 100644 --- a/public/tags/rock/index.html +++ b/public/tags/rock/index.html @@ -646,7 +646,7 @@ @@ -666,7 +666,7 @@ @@ -728,7 +728,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/sessionStorage/index.html b/public/tags/sessionStorage/index.html index c1be0ba..45b945d 100644 --- a/public/tags/sessionStorage/index.html +++ b/public/tags/sessionStorage/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/sticky布局/index.html b/public/tags/sticky布局/index.html index d968851..85e08c0 100644 --- a/public/tags/sticky布局/index.html +++ b/public/tags/sticky布局/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/ubuntu/index.html b/public/tags/ubuntu/index.html index b7a840d..c7ab5bf 100644 --- a/public/tags/ubuntu/index.html +++ b/public/tags/ubuntu/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/vscode/index.html b/public/tags/vscode/index.html index 445b69f..569e2dc 100644 --- a/public/tags/vscode/index.html +++ b/public/tags/vscode/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/vue-router/index.html b/public/tags/vue-router/index.html index e6b7f1a..0a88e6e 100644 --- a/public/tags/vue-router/index.html +++ b/public/tags/vue-router/index.html @@ -526,7 +526,7 @@ @@ -546,7 +546,7 @@ @@ -608,7 +608,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/vue/index.html b/public/tags/vue/index.html index eace859..ad230fd 100644 --- a/public/tags/vue/index.html +++ b/public/tags/vue/index.html @@ -648,7 +648,7 @@ @@ -668,7 +668,7 @@ @@ -730,7 +730,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/vuex/index.html b/public/tags/vuex/index.html index 4f5762e..2538819 100644 --- a/public/tags/vuex/index.html +++ b/public/tags/vuex/index.html @@ -587,7 +587,7 @@ @@ -607,7 +607,7 @@ @@ -669,7 +669,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/webpack/index.html b/public/tags/webpack/index.html index ac57403..124b622 100644 --- a/public/tags/webpack/index.html +++ b/public/tags/webpack/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/windows/index.html b/public/tags/windows/index.html index c3268ec..55b49d3 100644 --- a/public/tags/windows/index.html +++ b/public/tags/windows/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/人生感悟/index.html b/public/tags/人生感悟/index.html index e71e479..fbc570e 100644 --- a/public/tags/人生感悟/index.html +++ b/public/tags/人生感悟/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/全栈开发/index.html b/public/tags/全栈开发/index.html index 5710a42..77ca925 100644 --- a/public/tags/全栈开发/index.html +++ b/public/tags/全栈开发/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/兼容性/index.html b/public/tags/兼容性/index.html index a6c9ba7..ba5e1ff 100644 --- a/public/tags/兼容性/index.html +++ b/public/tags/兼容性/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/前端/index.html b/public/tags/前端/index.html index 3fae0d2..4acba96 100644 --- a/public/tags/前端/index.html +++ b/public/tags/前端/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/前端规划/index.html b/public/tags/前端规划/index.html index 1cb053d..8f482c7 100644 --- a/public/tags/前端规划/index.html +++ b/public/tags/前端规划/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/即兴原理/index.html b/public/tags/即兴原理/index.html index 7be2f20..075cc53 100644 --- a/public/tags/即兴原理/index.html +++ b/public/tags/即兴原理/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/古典/index.html b/public/tags/古典/index.html index 6c0aba0..a5a6468 100644 --- a/public/tags/古典/index.html +++ b/public/tags/古典/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/同步/index.html b/public/tags/同步/index.html index 7b0d317..a568bd0 100644 --- a/public/tags/同步/index.html +++ b/public/tags/同步/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/哲理/index.html b/public/tags/哲理/index.html index 7d95a95..5bf6475 100644 --- a/public/tags/哲理/index.html +++ b/public/tags/哲理/index.html @@ -709,7 +709,7 @@ @@ -729,7 +729,7 @@ @@ -791,7 +791,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/圣杯/index.html b/public/tags/圣杯/index.html index 294ff4a..81a0825 100644 --- a/public/tags/圣杯/index.html +++ b/public/tags/圣杯/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/布局/index.html b/public/tags/布局/index.html index 5456129..50ab34f 100644 --- a/public/tags/布局/index.html +++ b/public/tags/布局/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/异步/index.html b/public/tags/异步/index.html index f6dd298..3489f8e 100644 --- a/public/tags/异步/index.html +++ b/public/tags/异步/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/指弹/index.html b/public/tags/指弹/index.html index deb29ad..c33a45c 100644 --- a/public/tags/指弹/index.html +++ b/public/tags/指弹/index.html @@ -646,7 +646,7 @@ @@ -666,7 +666,7 @@ @@ -728,7 +728,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/电吉他/index.html b/public/tags/电吉他/index.html index a9f670e..c745744 100644 --- a/public/tags/电吉他/index.html +++ b/public/tags/电吉他/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/职场/index.html b/public/tags/职场/index.html index 235bad1..7f2713e 100644 --- a/public/tags/职场/index.html +++ b/public/tags/职场/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/腾讯云/index.html b/public/tags/腾讯云/index.html index e251c5e..a332ed7 100644 --- a/public/tags/腾讯云/index.html +++ b/public/tags/腾讯云/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/语义化/index.html b/public/tags/语义化/index.html index 83e3057..f80631f 100644 --- a/public/tags/语义化/index.html +++ b/public/tags/语义化/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/趣事/index.html b/public/tags/趣事/index.html index b9986ea..c8650cb 100644 --- a/public/tags/趣事/index.html +++ b/public/tags/趣事/index.html @@ -586,7 +586,7 @@ @@ -606,7 +606,7 @@ @@ -668,7 +668,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/轮播图/index.html b/public/tags/轮播图/index.html index a181d77..b4bcfdb 100644 --- a/public/tags/轮播图/index.html +++ b/public/tags/轮播图/index.html @@ -586,7 +586,7 @@ @@ -606,7 +606,7 @@ @@ -668,7 +668,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/面试/index.html b/public/tags/面试/index.html index 7c50865..a86a2c4 100644 --- a/public/tags/面试/index.html +++ b/public/tags/面试/index.html @@ -647,7 +647,7 @@ @@ -667,7 +667,7 @@ @@ -729,7 +729,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/tags/音乐/index.html b/public/tags/音乐/index.html index 2fc2f38..4762a56 100644 --- a/public/tags/音乐/index.html +++ b/public/tags/音乐/index.html @@ -585,7 +585,7 @@ @@ -605,7 +605,7 @@ @@ -667,7 +667,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/ubuntu下搭建一个nodejs-nginx-mongodb服务器.html b/public/ubuntu下搭建一个nodejs-nginx-mongodb服务器.html index 6627b5a..4b10c12 100644 --- a/public/ubuntu下搭建一个nodejs-nginx-mongodb服务器.html +++ b/public/ubuntu下搭建一个nodejs-nginx-mongodb服务器.html @@ -738,7 +738,7 @@ usr/local/nginx/sbin/nginx -v @@ -758,7 +758,7 @@ usr/local/nginx/sbin/nginx -v @@ -820,7 +820,7 @@ usr/local/nginx/sbin/nginx -v
  • 文章总数 - 57 + 61
  • diff --git a/public/urlMaker.html b/public/urlMaker.html index 649f28c..6693ce1 100644 --- a/public/urlMaker.html +++ b/public/urlMaker.html @@ -784,7 +784,7 @@ babel-preset-react @@ -804,7 +804,7 @@ babel-preset-react @@ -866,7 +866,7 @@ babel-preset-react
  • 文章总数 - 57 + 61
  • diff --git a/public/vscode-配置插件推荐.html b/public/vscode-配置插件推荐.html index e3f52e9..7563fd9 100644 --- a/public/vscode-配置插件推荐.html +++ b/public/vscode-配置插件推荐.html @@ -694,7 +694,7 @@ @@ -714,7 +714,7 @@ @@ -776,7 +776,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/vue-eleme.html b/public/vue-eleme.html index 5a05411..b374ed1 100644 --- a/public/vue-eleme.html +++ b/public/vue-eleme.html @@ -718,7 +718,7 @@ @@ -738,7 +738,7 @@ @@ -800,7 +800,7 @@
  • 文章总数 - 57 + 61
  • diff --git a/public/vuex-模块介绍.html b/public/vuex-模块介绍.html index 6686be5..790a7bc 100644 --- a/public/vuex-模块介绍.html +++ b/public/vuex-模块介绍.html @@ -572,7 +572,7 @@ increment({commit}) {