text: (window.webpackJsonp=window.webpackJsonp||[]).push([[89],{160:function(a,e,t){"use strict";t.r(e);var r=t(0),s=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var a=this,e=a.$createElement,t=a._self._c||e;return t("div",{staticClass:"content"},[t("h1",{attrs:{id:"promise-aysnc"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#promise-aysnc","aria-hidden":"true"}},[a._v("#")]),a._v(" Promise/Aysnc")]),a._v(" "),t("h4",{attrs:{id:"_1、es6定义变量"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_1、es6定义变量","aria-hidden":"true"}},[a._v("#")]),a._v(" 1、es6定义变量")]),a._v(" "),t("ol",[t("li",[a._v("var")]),a._v(" "),t("li",[a._v("let")]),a._v(" "),t("li",[a._v("import")]),a._v(" "),t("li",[a._v("class")]),a._v(" "),t("li",[a._v("function")]),a._v(" "),t("li",[a._v("const")])]),a._v(" "),t("h4",{attrs:{id:"_2、promise"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_2、promise","aria-hidden":"true"}},[a._v("#")]),a._v(" 2、Promise")]),a._v(" "),t("ul",[t("li",[a._v("是异步编程的一种解决方案")]),a._v(" "),t("li",[a._v("是一个对象")])]),a._v(" "),t("p",[t("strong",[a._v("缺点")])]),a._v(" "),t("ol",[t("li",[a._v("无法取消")])]),a._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[a._v("Promise.all()  会包装多个实例成为一个新的promise实例\n\nnew Promise((resolve.reject) =>{\n    // do some async function\n    if(true){\n        // resolve 代表成功的回调\n        resolve(data);\n    }else{\n        // reject 代表失败的回调\n        reject(data);\n    }\n})\n")])])]),t("h4",{attrs:{id:"_3、异步加载图片"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_3、异步加载图片","aria-hidden":"true"}},[a._v("#")]),a._v(" 3、异步加载图片")]),a._v(" "),t("ol",[t("li",[a._v("数据请求 -> 接口(Interface)")]),a._v(" "),t("li",[a._v("创建图片")]),a._v(" "),t("li",[a._v("插入到页面当中")])]),a._v(" "),t("h4",{attrs:{id:"_4、继承"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_4、继承","aria-hidden":"true"}},[a._v("#")]),a._v(" 4、继承")]),a._v(" "),t("p",[a._v("obj1 extends obj2")]),a._v(" "),t("p",[a._v("如果继承就一定要在contructor第一行加super()方法")]),a._v(" "),t("h4",{attrs:{id:"_5、异步加载"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_5、异步加载","aria-hidden":"true"}},[a._v("#")]),a._v(" 5、异步加载")]),a._v(" "),t("ol",[t("li",[a._v("ajax")]),a._v(" "),t("li",[a._v("加载图片")]),a._v(" "),t("li",[a._v("jsonp")])]),a._v(" "),t("h4",{attrs:{id:"_6、语法糖"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_6、语法糖","aria-hidden":"true"}},[a._v("#")]),a._v(" 6、语法糖")]),a._v(" "),t("p",[a._v("再不改变代码的情况下让代码更简洁")]),a._v(" "),t("h4",{attrs:{id:"_7、async"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_7、async","aria-hidden":"true"}},[a._v("#")]),a._v(" 7、async")]),a._v(" "),t("ol",[t("li",[a._v("内置执行器")]),a._v(" "),t("li",[a._v("更好的语义")]),a._v(" "),t("li",[a._v("更广的适用性")]),a._v(" "),t("li",[a._v("返回Promise")])])])}],!1,null,null,null);e.default=s.exports}}]);