diff --git a/404.html b/404.html new file mode 100644 index 0000000..92acc49 --- /dev/null +++ b/404.html @@ -0,0 +1,18 @@ + + + + + + 点滴记录 + + + + + + + + +
+ + + diff --git a/assets/css/0.styles.19f9c873.css b/assets/css/0.styles.19f9c873.css new file mode 100644 index 0000000..d71982b --- /dev/null +++ b/assets/css/0.styles.19f9c873.css @@ -0,0 +1,10 @@ +.medium-zoom-overlay{z-index:100}.medium-zoom-overlay~img{z-index:101}html{scroll-behavior:smooth}.dark .content__default code{background-color:rgba(58,58,92,.7);color:#fff}.page .page-title{display:none}.back-to-ceiling[data-v-c6073ba8]{background-color:#fff;background-color:var(--background-color);box-shadow:0 1px 6px 0 rgba(0,0,0,.2);box-shadow:var(--box-shadow);position:fixed;display:inline-block;text-align:center;cursor:pointer}.back-to-ceiling[data-v-c6073ba8]::hover{background:#d5dbe7}.back-to-ceiling .icon[data-v-c6073ba8]{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:26px;height:26px;fill:#3eaf7c}.fade-enter-active[data-v-c6073ba8],.fade-leave-active[data-v-c6073ba8]{transition:all .5s}.fade-enter[data-v-c6073ba8],.fade-leave-to[data-v-c6073ba8]{opacity:0;transform:translateY(120px)}.pagation[data-v-22b6649c]{font-weight:700;text-align:center;color:#888;color:var(--text-color);margin:20px auto 0;background:#f2f2f2;background:var(--background-color)}.pagation .pagation-list[data-v-22b6649c]{font-size:0;line-height:50px;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pagation .pagation-list span[data-v-22b6649c]{font-size:14px}.pagation .pagation-list span.jump[data-v-22b6649c],.pagation .pagation-list span.jumpinp input[data-v-22b6649c]{box-shadow:var(--box-shadow);border:1px solid var(--border-color)!important;border:1px solid #ccc}.pagation .pagation-list span.jump[data-v-22b6649c]{padding:5px 8px;border-radius:4px;cursor:pointer;margin-left:5px}.pagation .pagation-list span.jumpinp input[data-v-22b6649c]{width:55px;height:26px;background-color:var(--background-color);font-size:13px;border-radius:4px;text-align:center;outline:none}.pagation .pagation-list span.bgprimary[data-v-22b6649c]{cursor:default;color:#fff;background:#3eaf7c;border-color:#3eaf7c}.pagation .pagation-list span.ellipsis[data-v-22b6649c]{padding:0 8px}.pagation .pagation-list span.jumppoint[data-v-22b6649c]{margin:0 10px 0 30px}.valine-wrapper #valine.v .vbtn{color:#2c3e50;color:var(--text-color);border:1px solid #eaecef;border-color:var(--border-color)}.valine-wrapper #valine.v .vbtn:hover{color:#3eaf7c;border-color:#3eaf7c}.valine-wrapper #valine.v .vwrap{background:rgba(27,31,35,.05);background:var(--code-color);border:1px solid #eaecef;border-color:var(--border-color)}.valine-wrapper #valine.v .vwrap .vheader .vinput{border-bottom:1px dashed var(--border-color)}.valine-wrapper #valine.v .vwrap .vheader .vinput:focus{border-bottom-color:#3eaf7c}.valine-wrapper #valine.v .vwrap .vheader .vinput:-internal-autofill-selected{background-color:var(--code-color)!important}.valine-wrapper #valine.v .vinfo{padding-left:.6rem}.valine-wrapper #valine.v .vcard .vquote{margin-left:0;border-left:none}.valine-wrapper #valine.v .vcard .vimg{width:2.8rem;height:2.8rem;border-radius:.25rem;border:none}.valine-wrapper #valine.v .vcard .vhead .vnick{color:#3eaf7c}.valine-wrapper #valine.v .vcard .vhead .vnick:before{background:#3eaf7c}.valine-wrapper #valine.v .vh{border-bottom:none}.valine-wrapper #valine.v .vh .vhead .vsys{color:#3eaf7c;color:var(--text-color);background:rgba(27,31,35,.05);background:var(--code-color)}.valine-wrapper #valine.v .vh .vmeta{margin-bottom:1rem}.valine-wrapper #valine.v .vh .vmeta .vat{margin-right:.3rem;background:rgba(27,31,35,.05);background:var(--code-color);border-radius:.25rem;padding:0 .4rem;color:var(--text-color);border:1px solid #eaecef;border-color:var(--border-color)}.valine-wrapper #valine.v .vh .vmeta .vat:hover{color:#3eaf7c;border-color:#3eaf7c}.valine-wrapper #valine.v .vh .vcontent{background:rgba(27,31,35,.05);background:var(--code-color);border-radius:.25rem;margin:0 .3rem;padding:.1rem .6rem .05rem}.valine-wrapper #valine.v .vh .vcontent p .at{color:#3eaf7c}.valine-wrapper #valine.v .vh .vcontent.expand:before{z-index:1;background:linear-gradient(180deg,hsla(0,0%,100%,0),#fff);background:linear-gradient(180deg,hsla(0,0%,100%,0),var(--background-color))}.valine-wrapper #valine.v .vh .vcontent.expand:after{color:#3eaf7c;color:var(--text-color);background:#fff;background:var(--background-color)}.valine-wrapper #valine.v .info{padding-right:.6rem}.valine-wrapper #valine.v .vbtn,.valine-wrapper #valine.v code,.valine-wrapper #valine.v pre{background:var(--background-color);color:var(--text-color)}.valine-wrapper #valine.v a{color:#3eaf7c}.valine-wrapper #valine.v a:before{background:#3eaf7c} + +/*! + * vssue - A vue-powered issue-based comment plugin + * + * @version v1.4.8 + * @link https://vssue.js.org + * @license MIT + * @copyright 2018-2021 meteorlxy + */.vssue{color:#2c3e50}@media screen and (max-width:576px){.vssue .vssue-new-comment .vssue-new-comment-body{margin-left:60px}}@media screen and (min-width:577px){.vssue .vssue-new-comment .vssue-new-comment-body{margin-left:70px}}@media screen and (max-width:576px){.vssue .vssue-new-comment .vssue-new-comment-footer{text-align:center}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-new-comment-operations{margin-top:10px}}@media screen and (min-width:577px){.vssue .vssue-new-comment .vssue-new-comment-footer{margin-left:70px;text-align:right}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-current-user{float:left}}@media screen and (max-width:576px){.vssue .vssue-comments .vssue-comment .vssue-comment-body{margin-left:60px}}@media screen and (min-width:577px){.vssue .vssue-comments .vssue-comment .vssue-comment-body{margin-left:70px}}@media screen and (max-width:576px){.vssue .vssue-pagination{flex-direction:column;justify-content:center;text-align:center}}@media screen and (max-width:576px){.vssue .vssue-pagination .vssue-pagination-page{margin-top:10px}}@media screen and (min-width:577px){.vssue .vssue-pagination .vssue-pagination-page{text-align:right}}.markdown-body .tab-size[data-tab-size="1"]{-o-tab-size:1}.markdown-body .tab-size[data-tab-size="2"]{-o-tab-size:2}.markdown-body .tab-size[data-tab-size="3"]{-o-tab-size:3}.markdown-body .tab-size[data-tab-size="4"]{-o-tab-size:4}.markdown-body .tab-size[data-tab-size="5"]{-o-tab-size:5}.markdown-body .tab-size[data-tab-size="6"]{-o-tab-size:6}.markdown-body .tab-size[data-tab-size="7"]{-o-tab-size:7}.markdown-body .tab-size[data-tab-size="8"]{-o-tab-size:8}.markdown-body .tab-size[data-tab-size="9"]{-o-tab-size:9}.markdown-body .tab-size[data-tab-size="10"]{-o-tab-size:10}.markdown-body .tab-size[data-tab-size="11"]{-o-tab-size:11}.markdown-body .tab-size[data-tab-size="12"]{-o-tab-size:12}@font-face{font-family:octicons-link;src:url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format("woff")}.markdown-body .octicon{display:inline-block;fill:currentColor;vertical-align:text-bottom}.markdown-body .anchor{float:left;line-height:1;margin-left:-20px;padding-right:4px}.markdown-body .anchor:focus{outline:none}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{color:#1b1f23;vertical-align:middle;visibility:hidden}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{visibility:visible}.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#24292e;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body .pl-c{color:#6a737d}.markdown-body .pl-c1,.markdown-body .pl-s .pl-v{color:#005cc5}.markdown-body .pl-e,.markdown-body .pl-en{color:#6f42c1}.markdown-body .pl-s .pl-s1,.markdown-body .pl-smi{color:#24292e}.markdown-body .pl-ent{color:#22863a}.markdown-body .pl-k{color:#d73a49}.markdown-body .pl-pds,.markdown-body .pl-s,.markdown-body .pl-s .pl-pse .pl-s1,.markdown-body .pl-sr,.markdown-body .pl-sr .pl-cce,.markdown-body .pl-sr .pl-sra,.markdown-body .pl-sr .pl-sre{color:#032f62}.markdown-body .pl-smw,.markdown-body .pl-v{color:#e36209}.markdown-body .pl-bu{color:#b31d28}.markdown-body .pl-ii{background-color:#b31d28;color:#fafbfc}.markdown-body .pl-c2{background-color:#d73a49;color:#fafbfc}.markdown-body .pl-c2:before{content:"^M"}.markdown-body .pl-sr .pl-cce{color:#22863a;font-weight:700}.markdown-body .pl-ml{color:#735c0f}.markdown-body .pl-mh,.markdown-body .pl-mh .pl-en,.markdown-body .pl-ms{color:#005cc5;font-weight:700}.markdown-body .pl-mi{color:#24292e;font-style:italic}.markdown-body .pl-mb{color:#24292e;font-weight:700}.markdown-body .pl-md{background-color:#ffeef0;color:#b31d28}.markdown-body .pl-mi1{background-color:#f0fff4;color:#22863a}.markdown-body .pl-mc{background-color:#ffebda;color:#e36209}.markdown-body .pl-mi2{background-color:#005cc5;color:#f6f8fa}.markdown-body .pl-mdr{color:#6f42c1;font-weight:700}.markdown-body .pl-ba{color:#586069}.markdown-body .pl-sg{color:#959da5}.markdown-body .pl-corl{color:#032f62;text-decoration:underline}.markdown-body details{display:block}.markdown-body summary{display:list-item}.markdown-body a{background-color:transparent}.markdown-body a:active,.markdown-body a:hover{outline-width:0}.markdown-body strong{font-weight:inherit;font-weight:bolder}.markdown-body h1{margin:.67em 0}.markdown-body img{border-style:none}.markdown-body code,.markdown-body kbd,.markdown-body pre{font-family:monospace,monospace;font-size:1em}.markdown-body hr{box-sizing:content-box;overflow:visible}.markdown-body input{font:inherit;margin:0;overflow:visible}.markdown-body [type=checkbox]{box-sizing:border-box;padding:0}.markdown-body *{box-sizing:border-box}.markdown-body input{font-family:inherit;font-size:inherit;line-height:inherit}.markdown-body a{color:#0366d6;text-decoration:none}.markdown-body a:hover{text-decoration:underline}.markdown-body strong{font-weight:600}.markdown-body hr{background:transparent;border-bottom:1px solid #dfe2e5;height:0;margin:15px 0;overflow:hidden}.markdown-body hr:after,.markdown-body hr:before{content:"";display:table}.markdown-body hr:after{clear:both}.markdown-body table{border-collapse:collapse;border-spacing:0}.markdown-body td,.markdown-body th{padding:0}.markdown-body details summary{cursor:pointer}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-bottom:0;margin-top:0}.markdown-body h1{font-size:32px}.markdown-body h1,.markdown-body h2{font-weight:600}.markdown-body h2{font-size:24px}.markdown-body h3{font-size:20px}.markdown-body h3,.markdown-body h4{font-weight:600}.markdown-body h4{font-size:16px}.markdown-body h5{font-size:14px}.markdown-body h5,.markdown-body h6{font-weight:600}.markdown-body h6{font-size:12px}.markdown-body p{margin-bottom:10px;margin-top:0}.markdown-body blockquote{margin:0}.markdown-body ol,.markdown-body ul{margin-bottom:0;margin-top:0;padding-left:0}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ol ol ol,.markdown-body ol ul ol,.markdown-body ul ol ol,.markdown-body ul ul ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body code,.markdown-body pre{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px}.markdown-body pre{margin-bottom:0;margin-top:0}.markdown-body input::-webkit-inner-spin-button,.markdown-body input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.markdown-body .border{border:1px solid #e1e4e8!important}.markdown-body .border-0{border:0!important}.markdown-body .border-bottom{border-bottom:1px solid #e1e4e8!important}.markdown-body .rounded-1{border-radius:3px!important}.markdown-body .bg-white{background-color:#fff!important}.markdown-body .bg-gray-light{background-color:#fafbfc!important}.markdown-body .text-gray-light{color:#6a737d!important}.markdown-body .mb-0{margin-bottom:0!important}.markdown-body .my-2{margin-bottom:8px!important;margin-top:8px!important}.markdown-body .py-0{padding-bottom:0!important;padding-top:0!important}.markdown-body .py-2{padding-bottom:8px!important;padding-top:8px!important}.markdown-body .pl-3,.markdown-body .px-3{padding-left:16px!important}.markdown-body .px-3{padding-right:16px!important}.markdown-body .f6{font-size:12px!important}.markdown-body .lh-condensed{line-height:1.25!important}.markdown-body .text-bold{font-weight:600!important}.markdown-body:after,.markdown-body:before{content:"";display:table}.markdown-body:after{clear:both}.markdown-body>:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-bottom:16px;margin-top:0}.markdown-body hr{background-color:#e1e4e8;border:0;height:.25em;margin:24px 0;padding:0}.markdown-body blockquote{border-left:.25em solid #dfe2e5;color:#6a737d;padding:0 1em}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body kbd{border:1px solid #c6cbd1;border-bottom-color:#959da5;box-shadow:inset 0 -1px 0 #959da5;font-size:11px}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{font-weight:600;line-height:1.25;margin-bottom:16px;margin-top:24px}.markdown-body h1{font-size:2em}.markdown-body h1,.markdown-body h2{border-bottom:1px solid #eaecef;padding-bottom:.3em}.markdown-body h2{font-size:1.5em}.markdown-body h3{font-size:1.25em}.markdown-body h4{font-size:1em}.markdown-body h5{font-size:.875em}.markdown-body h6{color:#6a737d;font-size:.85em}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-bottom:0;margin-top:0}.markdown-body li{word-wrap:break-all}.markdown-body li>p{margin-top:16px}.markdown-body li+li{margin-top:.25em}.markdown-body dl{padding:0}.markdown-body dl dt{font-size:1em;font-style:italic;font-weight:600;margin-top:16px;padding:0}.markdown-body dl dd{margin-bottom:16px;padding:0 16px}.markdown-body table{display:block;overflow:auto;width:100%}.markdown-body table th{font-weight:600}.markdown-body table td,.markdown-body table th{border:1px solid #dfe2e5;padding:6px 13px}.markdown-body table tr{background-color:#fff;border-top:1px solid #c6cbd1}.markdown-body table tr:nth-child(2n){background-color:#f6f8fa}.markdown-body img{background-color:#fff;box-sizing:content-box;max-width:100%}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body code{background-color:rgba(27,31,35,.05);border-radius:3px;font-size:85%;margin:0;padding:.2em .4em}.markdown-body pre{word-wrap:normal}.markdown-body pre>code{background:transparent;border:0;font-size:100%;margin:0;padding:0;white-space:pre;word-break:normal}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body .highlight pre,.markdown-body pre{background-color:#f6f8fa;border-radius:3px;font-size:85%;line-height:1.45;overflow:auto;padding:16px}.markdown-body pre code{background-color:transparent;border:0;display:inline;line-height:inherit;margin:0;max-width:auto;overflow:visible;padding:0;word-wrap:normal}.markdown-body .commit-tease-sha{color:#444d56;display:inline-block;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:90%}.markdown-body .blob-wrapper{border-bottom-left-radius:3px;border-bottom-right-radius:3px;overflow-x:auto;overflow-y:hidden}.markdown-body .blob-wrapper-embedded{max-height:240px;overflow-y:auto}.markdown-body .blob-num{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:rgba(27,31,35,.3);cursor:pointer;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px;line-height:20px;min-width:50px;padding-left:10px;padding-right:10px;text-align:right;user-select:none;vertical-align:top;white-space:nowrap;width:1%}.markdown-body .blob-num:hover{color:rgba(27,31,35,.6)}.markdown-body .blob-num:before{content:attr(data-line-number)}.markdown-body .blob-code{line-height:20px;padding-left:10px;padding-right:10px;position:relative;vertical-align:top}.markdown-body .blob-code-inner{color:#24292e;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px;overflow:visible;white-space:pre;word-wrap:normal}.markdown-body .pl-token.active,.markdown-body .pl-token:hover{background:#ffea7f;cursor:pointer}.markdown-body kbd{background-color:#fafbfc;border:1px solid #d1d5da;border-bottom-color:#c6cbd1;border-radius:3px;box-shadow:inset 0 -1px 0 #c6cbd1;color:#444d56;display:inline-block;font:11px SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;line-height:10px;padding:3px 5px;vertical-align:middle}.markdown-body :checked+.radio-label{border-color:#0366d6;position:relative;z-index:1}.markdown-body .tab-size[data-tab-size="1"]{-moz-tab-size:1;tab-size:1}.markdown-body .tab-size[data-tab-size="2"]{-moz-tab-size:2;tab-size:2}.markdown-body .tab-size[data-tab-size="3"]{-moz-tab-size:3;tab-size:3}.markdown-body .tab-size[data-tab-size="4"]{-moz-tab-size:4;tab-size:4}.markdown-body .tab-size[data-tab-size="5"]{-moz-tab-size:5;tab-size:5}.markdown-body .tab-size[data-tab-size="6"]{-moz-tab-size:6;tab-size:6}.markdown-body .tab-size[data-tab-size="7"]{-moz-tab-size:7;tab-size:7}.markdown-body .tab-size[data-tab-size="8"]{-moz-tab-size:8;tab-size:8}.markdown-body .tab-size[data-tab-size="9"]{-moz-tab-size:9;tab-size:9}.markdown-body .tab-size[data-tab-size="10"]{-moz-tab-size:10;tab-size:10}.markdown-body .tab-size[data-tab-size="11"]{-moz-tab-size:11;tab-size:11}.markdown-body .tab-size[data-tab-size="12"]{-moz-tab-size:12;tab-size:12}.markdown-body .task-list-item{list-style-type:none}.markdown-body .task-list-item+.task-list-item{margin-top:3px}.markdown-body .task-list-item input{margin:0 .2em .25em -1.6em;vertical-align:middle}.markdown-body hr{border-bottom-color:#eee}.markdown-body .pl-0{padding-left:0!important}.markdown-body .pl-1{padding-left:4px!important}.markdown-body .pl-2{padding-left:8px!important}.markdown-body .pl-3{padding-left:16px!important}.markdown-body .pl-4{padding-left:24px!important}.markdown-body .pl-5{padding-left:32px!important}.markdown-body .pl-6{padding-left:40px!important}.markdown-body .pl-7{padding-left:48px!important}.markdown-body .pl-8{padding-left:64px!important}.markdown-body .pl-9{padding-left:80px!important}.markdown-body .pl-10{padding-left:96px!important}.markdown-body .pl-11{padding-left:112px!important}.markdown-body .pl-12{padding-left:128px!important}.clearfix:after,.vssue .vssue-new-comment .vssue-new-comment-footer:after{display:block;clear:both;content:""}.vssue{width:100%;color:#242424;font-size:16px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:10px}.vssue .vssue-button{outline:none;cursor:pointer;padding:10px 20px;font-size:1.05;font-weight:700;color:#3eaf7c;background-color:transparent;border:2px solid #3eaf7c;border-radius:10px}.vssue .vssue-button:disabled{cursor:not-allowed;color:#eaecef;border-color:#eaecef}.vssue .vssue-button:disabled .vssue-icon{fill:#eaecef}.vssue .vssue-button:not(:disabled).vssue-button-default{color:#a3aab1;border-color:#a3aab1}.vssue .vssue-button:not(:disabled).vssue-button-primary{color:#3eaf7c;border-color:#3eaf7c}.vssue .vssue-icon{width:1em;height:1em;vertical-align:-.15em;fill:#3eaf7c;overflow:hidden}.vssue .vssue-icon-loading{animation:vssue-keyframe-rotation 1s linear infinite}@keyframes vssue-keyframe-rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.vssue .fade-appear-active,.vssue .fade-enter-active{transition:all .3s ease}.vssue .fade-leave-active{transition:all .3s cubic-bezier(1,.5,.8,1)}.vssue .fade-appear,.vssue .fade-enter,.vssue .fade-leave-to{opacity:0}.vssue .vssue-notice{position:relative;z-index:100;transform:translateY(-11px)}.vssue .vssue-notice .vssue-alert{position:absolute;z-index:101;cursor:pointer;top:0;padding:10px 20px;width:100%;color:#3eaf7c;border:2px solid #c3ead8;border-radius:5px;background-color:#f5fbf8}.vssue .vssue-notice .vssue-progress{position:absolute;top:0;left:0;height:2px;background-color:#3eaf7c}.vssue .vssue-status{text-align:center;padding-top:20px;padding-bottom:10px;color:#3eaf7c}.vssue .vssue-status .vssue-icon{font-size:1.4em}.vssue .vssue-status .vssue-status-info{margin-top:10px;margin-bottom:10px}.vssue .vssue-header{padding-bottom:10px;border-bottom:1px solid #eaecef;margin-bottom:10px;overflow:hidden}.vssue .vssue-header .vssue-header-powered-by{float:right}.vssue .vssue-new-comment{border-bottom:1px solid #eaecef;margin-top:10px;margin-bottom:10px}.vssue .vssue-new-comment .vssue-comment-avatar{float:left;width:50px;height:50px}.vssue .vssue-new-comment .vssue-comment-avatar img{width:50px;height:50px}.vssue .vssue-new-comment .vssue-comment-avatar .vssue-icon{cursor:pointer;padding:5px;font-size:50px;fill:#757f8a}.vssue .vssue-new-comment .vssue-new-comment-body{position:relative}@media screen and (max-width:719px){.vssue .vssue-new-comment .vssue-new-comment-body{margin-left:60px}}@media screen and (min-width:720px){.vssue .vssue-new-comment .vssue-new-comment-body{margin-left:70px}}.vssue .vssue-new-comment .vssue-new-comment-body .vssue-new-comment-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vssue .vssue-new-comment .vssue-new-comment-footer{margin-top:10px;margin-bottom:10px}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-current-user{color:#a3aab1}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-current-user .vssue-logout{cursor:pointer;text-decoration:underline;color:#a3aab1;font-weight:400}@media screen and (max-width:719px){.vssue .vssue-new-comment .vssue-new-comment-footer{text-align:center}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-new-comment-operations{margin-top:10px}}@media screen and (min-width:720px){.vssue .vssue-new-comment .vssue-new-comment-footer{margin-left:70px;text-align:right}.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-current-user{float:left}}.vssue .vssue-new-comment .vssue-new-comment-input{resize:none;outline:none;width:100%;padding:15px;font-size:16px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;background-color:#f5fbf8;border:1px solid #eaecef;border-radius:5px}.vssue .vssue-new-comment .vssue-new-comment-input:disabled{cursor:not-allowed;background-color:#f0f2f4}.vssue .vssue-new-comment .vssue-new-comment-input:focus{background-color:#fff;border-color:#9adbbe;box-shadow:0 0 1px 1px #9adbbe}.vssue .vssue-new-comment .vssue-new-comment-input::-moz-placeholder{color:#a3aab1}.vssue .vssue-new-comment .vssue-new-comment-input::placeholder{color:#a3aab1}.vssue .vssue-comments .vssue-comment{margin:15px 0}.vssue .vssue-comments .vssue-comment.vssue-comment-edit-mode .vssue-comment-main{border-color:#9adbbe;box-shadow:0 0 1px 1px #9adbbe}.vssue .vssue-comments .vssue-comment.vssue-comment-disabled{pointer-events:none}.vssue .vssue-comments .vssue-comment.vssue-comment-disabled .vssue-comment-body{background-color:#f9f9fa}.vssue .vssue-comments .vssue-comment .vssue-comment-avatar{float:left;width:50px;height:50px}.vssue .vssue-comments .vssue-comment .vssue-comment-avatar img{width:50px;height:50px}@media screen and (max-width:719px){.vssue .vssue-comments .vssue-comment .vssue-comment-body{margin-left:60px}}@media screen and (min-width:720px){.vssue .vssue-comments .vssue-comment .vssue-comment-body{margin-left:70px}}.vssue .vssue-comments .vssue-comment .vssue-comment-header{padding:10px 15px;overflow:hidden;border-top-left-radius:5px;border-top-right-radius:5px;border:1px solid #eaecef;border-bottom:none}.vssue .vssue-comments .vssue-comment .vssue-comment-header .vssue-comment-created-at{float:right;cursor:default;color:#a3aab1}.vssue .vssue-comments .vssue-comment .vssue-comment-main{padding:15px;border:1px solid #eaecef}.vssue .vssue-comments .vssue-comment .vssue-comment-main .vssue-edit-comment-input{resize:none;outline:none;border:none;width:100%;background:transparent}.vssue .vssue-comments .vssue-comment .vssue-comment-footer{padding:10px 15px;overflow:hidden;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border:1px solid #eaecef;border-top:none}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-hint{cursor:default;color:#a3aab1}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-reactions .vssue-comment-reaction{cursor:pointer;display:inline-block;margin-right:8px;color:#3eaf7c}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-operations{float:right;color:#3eaf7c}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-operations .vssue-comment-operation{cursor:pointer;margin-left:8px}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-operations .vssue-comment-operation.vssue-comment-operation-muted{color:#a3aab1}.vssue .vssue-comments .vssue-comment .vssue-comment-footer .vssue-comment-operations .vssue-comment-operation.vssue-comment-operation-muted .vssue-icon{fill:#a3aab1}.vssue .vssue-pagination{cursor:default;display:flex;padding:5px;color:#a3aab1}@media screen and (max-width:719px){.vssue .vssue-pagination{flex-direction:column;justify-content:center;text-align:center}}.vssue .vssue-pagination .vssue-pagination-loading,.vssue .vssue-pagination .vssue-pagination-page,.vssue .vssue-pagination .vssue-pagination-per-page{flex:1}@media screen and (max-width:719px){.vssue .vssue-pagination .vssue-pagination-page{margin-top:10px}}@media screen and (min-width:720px){.vssue .vssue-pagination .vssue-pagination-page{text-align:right}}.vssue .vssue-pagination .vssue-pagination-select{outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:1px solid #9adbbe;padding-left:.2rem;padding-right:1rem;background-color:transparent;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cstyle/%3E%3C/defs%3E%3Cpath d='M676.395 432.896a21.333 21.333 0 0 0-30.166 0L511.061 568.021 377.728 434.645a21.333 21.333 0 0 0-30.165 30.166l148.394 148.48a21.419 21.419 0 0 0 30.208 0l150.23-150.187a21.333 21.333 0 0 0 0-30.208'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:100%}.vssue .vssue-pagination .vssue-pagination-select:disabled{cursor:not-allowed}.vssue .vssue-pagination .vssue-pagination-select:focus{background-color:#fff;box-shadow:0 0 .2px .2px #9adbbe}.vssue .vssue-pagination .vssue-pagination-link{display:inline-block;min-width:1em;text-align:center}.vssue .vssue-pagination .vssue-pagination-link.disabled{pointer-events:none}.vssue .vssue-pagination .vssue-pagination-link:not(.disabled){color:#3eaf7c;font-weight:500;cursor:pointer}.vssue,.vssue *{box-sizing:border-box}.vssue :not(.vssue-comment-content) a{cursor:pointer;font-weight:500;color:#3eaf7c;text-decoration:none}.vssue :not(.vssue-comment-content) hr{display:block;height:1px;border:0;border-top:1px solid #eaecef;margin:1.2rem 0;padding:0}.vssue-wrapper.vssue{color:#2c3e50;color:var(--text-color)}.vssue-wrapper.vssue .vssue-new-comment{border-bottom:1px solid #eaecef;border-bottom:1px solid var(--border-color)}.vssue-wrapper.vssue .vssue-new-comment .vssue-new-comment-input:disabled{background-color:#fff;background-color:var(--background-color);border:1px solid #eaecef;border:1px solid var(--border-color)}.vssue-wrapper.vssue .vssue-new-comment .vssue-new-comment-footer .vssue-current-user{color:#2c3e50;color:var(--text-color)}.vssue-wrapper.vssue .vssue-header{border-bottom:1px solid #eaecef;border-bottom:1px solid var(--border-color)}.vssue-wrapper.vssue .vssue-comments .vssue-pagination .vssue-pagination-per-page .vssue-pagination-select{color:var(--text-color)}.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-footer,.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-header,.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-main{border:none}.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-footer,.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-main{background:var(--code-color)}.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-body .vssue-comment-footer{border-top:2px solid var(--background-color)}.vssue-wrapper.vssue .vssue-comments .vssue-comment .vssue-comment-avatar img{width:2.8rem;height:2.8rem;border-radius:.25rem}.vssue-wrapper.vssue .markdown-body{color:var(--text-color)}#nprogress{pointer-events:none}#nprogress .bar{background:#3eaf7c;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #3eaf7c,0 0 5px #3eaf7c;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border-color:#3eaf7c transparent transparent #3eaf7c;border-style:solid;border-width:2px;border-radius:50%;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.icon.outbound{color:#aaa;display:inline-block;vertical-align:middle;position:relative;top:-1px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.algolia-search-wrapper>span{vertical-align:middle}.algolia-search-wrapper .algolia-autocomplete{line-height:normal}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu{background-color:var(--background-color);border-radius:.25rem;font-size:15px;margin:6px 0 0;padding:4px;text-align:left;box-shadow:var(--box-shadow)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu:before{display:none}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu [class*=ds-dataset-]{background-color:var(--background-color);border:none;padding:0}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestions{margin-top:0}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestion{border-bottom:1px solid var(--border-color)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion--highlight{color:#3eaf7c}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion{border-color:var(--border-color);padding:0}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header{padding:5px 10px;margin-top:0;background:#3eaf7c;color:#fff;font-weight:600}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight{background:hsla(0,0%,100%,.6)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--wrapper{background:var(--background-color);padding:0}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--title{font-weight:600;margin-bottom:0;color:var(--text-color)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{vertical-align:top;padding:5px 7px 5px 5px;border-color:var(--border-color);background:var(--background-color)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:after{display:none}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column-text{color:var(--text-color)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-footer{border-color:var(--border-color);background:var(--background-color)}.algolia-search-wrapper .algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--content{background-color:#e7edf3!important;color:#242424}@media (min-width:719px){.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{float:none;width:150px;min-width:150px;display:table-cell}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content{float:none;display:table-cell;width:100%;vertical-align:top}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .ds-dropdown-menu{min-width:515px!important}}@media (max-width:719px){.algolia-search-wrapper .ds-dropdown-menu{min-width:calc(100vw - 4rem)!important;max-width:calc(100vw - 4rem)!important}.algolia-search-wrapper .algolia-docsearch-suggestion--wrapper{padding:5px 7px 5px 5px!important}.algolia-search-wrapper .algolia-docsearch-suggestion--subcategory-column{padding:0!important;background:var(--border-color)!important}.algolia-search-wrapper .algolia-docsearch-suggestion--subcategory-column-text:after{content:" > ";font-size:10px;line-height:14.4px;display:inline-block;width:5px;margin:-3px 3px 0;vertical-align:middle}}.home{padding:3.6rem 2rem 0;max-width:960px;margin:0 auto}.home .hero{text-align:center}.home .hero h1{display:block;font-size:2.5rem;color:var(--text-color)}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.8rem auto}.home .hero .description{font-size:1.6rem;line-height:1.3;color:var(--text-color)}.home .hero .action-button{display:inline-block;font-size:1.2rem;color:#fff;background-color:#3eaf7c;padding:.2rem 1.2rem;border-radius:.25rem;transition:background-color .1s ease;box-sizing:border-box}.home .hero .action-button:hover{background-color:#4abf8a}.home .features{border-top:1px solid var(--border-color);padding:1.2rem 0;margin-top:2.5rem;display:flex;flex-wrap:wrap;align-items:flex-start;align-content:stretch;justify-content:space-between}.home .feature{flex-grow:1;flex-basis:30%;max-width:30%;transition:all .5s;color:var(--text-color)}.home .feature h2{font-size:1.6rem;font-weight:500;border-bottom:none;padding-bottom:0}.home .feature:hover{transform:scale(1.05)}@media (max-width:719px){.home .features{flex-direction:column}.home .feature{max-width:100%;padding:0 2.5rem}}@media (max-width:419px){.home{padding-left:1.5rem;padding-right:1.5rem}.home .hero img{max-height:210px;margin:2rem auto 1.2rem}.home .hero h1{font-size:2rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.2rem auto}.home .hero .description{font-size:1.2rem}.home .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home .feature h2{font-size:1.25rem}}.badge[data-v-8f29db2c]{display:inline-block;font-size:14px;height:18px;line-height:18px;border-radius:.25rem;padding:0 6px;color:#fff}.badge.green[data-v-8f29db2c],.badge.tip[data-v-8f29db2c],.badge[data-v-8f29db2c]{background-color:#42b983}.badge.error[data-v-8f29db2c]{background-color:#da5961}.badge.warn[data-v-8f29db2c],.badge.warning[data-v-8f29db2c],.badge.yellow[data-v-8f29db2c]{background-color:#e7c000}.badge+.badge[data-v-8f29db2c]{margin-left:5px}.searchbox{display:inline-block;position:relative;width:200px;height:32px!important;white-space:nowrap;box-sizing:border-box;visibility:visible!important}.searchbox .algolia-autocomplete{display:block;width:100%;height:100%}.searchbox__wrapper{width:100%;height:100%;z-index:999;position:relative}.searchbox__input{display:inline-block;box-sizing:border-box;transition:box-shadow .4s ease,background .4s ease;border:0;border-radius:16px;box-shadow:inset 0 0 0 1px #ccc;background:#fff!important;padding:0 26px 0 32px;width:100%;height:100%;vertical-align:middle;white-space:normal;font-size:12px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbox__input::-webkit-search-cancel-button,.searchbox__input::-webkit-search-decoration,.searchbox__input::-webkit-search-results-button,.searchbox__input::-webkit-search-results-decoration{display:none}.searchbox__input:hover{box-shadow:inset 0 0 0 1px #b3b3b3}.searchbox__input:active,.searchbox__input:focus{outline:0;box-shadow:inset 0 0 0 1px #aaa;background:#fff}.searchbox__input::-moz-placeholder{color:#aaa}.searchbox__input::placeholder{color:#aaa}.searchbox__submit{position:absolute;top:0;margin:0;border:0;border-radius:16px 0 0 16px;background-color:rgba(69,142,225,0);padding:0;width:32px;height:100%;vertical-align:middle;text-align:center;font-size:inherit;-webkit-user-select:none;-moz-user-select:none;user-select:none;right:inherit;left:0}.searchbox__submit:before{display:inline-block;margin-right:-4px;height:100%;vertical-align:middle;content:""}.searchbox__submit:active,.searchbox__submit:hover{cursor:pointer}.searchbox__submit:focus{outline:0}.searchbox__submit svg{width:14px;height:14px;vertical-align:middle;fill:#6d7e96}.searchbox__reset{display:block;position:absolute;top:8px;right:8px;margin:0;border:0;background:none;cursor:pointer;padding:0;font-size:inherit;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:rgba(0,0,0,.5)}.searchbox__reset.hide{display:none}.searchbox__reset:focus{outline:0}.searchbox__reset svg{display:block;margin:4px;width:8px;height:8px}.searchbox__input:valid~.searchbox__reset{display:block;animation-name:sbx-reset-in;animation-duration:.15s}@keyframes sbx-reset-in{0%{transform:translate3d(-20%,0,0);opacity:0}to{transform:none;opacity:1}}.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu{right:0!important;left:inherit!important}.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu:before{right:48px}.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu{left:0!important;right:inherit!important}.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu:before{left:48px}.algolia-autocomplete .ds-dropdown-menu{top:-6px;border-radius:4px;margin:6px 0 0;padding:0;text-align:left;height:auto;position:relative;background:transparent;border:none;z-index:999;max-width:600px;min-width:500px;box-shadow:0 1px 0 0 rgba(0,0,0,.2),0 2px 3px 0 rgba(0,0,0,.1)}.algolia-autocomplete .ds-dropdown-menu:before{display:block;position:absolute;content:"";width:14px;height:14px;background:#fff;z-index:1000;top:-7px;border-top:1px solid #d9d9d9;border-right:1px solid #d9d9d9;transform:rotate(-45deg);border-radius:2px}.algolia-autocomplete .ds-dropdown-menu .ds-suggestions{position:relative;z-index:1000;margin-top:8px}.algolia-autocomplete .ds-dropdown-menu .ds-suggestions a:hover{text-decoration:none}.algolia-autocomplete .ds-dropdown-menu .ds-suggestion{cursor:pointer}.algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion.suggestion-layout-simple,.algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion:not(.suggestion-layout-simple) .algolia-docsearch-suggestion--content{background-color:rgba(69,142,225,.05)}.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-]{position:relative;border:1px solid #d9d9d9;background:#fff;border-radius:4px;overflow:auto;padding:0 8px 8px}.algolia-autocomplete .ds-dropdown-menu *{box-sizing:border-box}.algolia-autocomplete .algolia-docsearch-suggestion{display:block;position:relative;padding:0 8px;background:#fff;color:#02060c;overflow:hidden}.algolia-autocomplete .algolia-docsearch-suggestion--highlight{color:#174d8c;background:rgba(143,187,237,.1);padding:.1em .05em}.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl0 .algolia-docsearch-suggestion--highlight,.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl1 .algolia-docsearch-suggestion--highlight,.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight{padding:0 0 1px;background:inherit;box-shadow:inset 0 -2px 0 0 rgba(69,142,225,.8);color:inherit}.algolia-autocomplete .algolia-docsearch-suggestion--content{display:block;float:right;width:70%;position:relative;padding:5.33333px 0 5.33333px 10.66667px;cursor:pointer}.algolia-autocomplete .algolia-docsearch-suggestion--content:before{content:"";position:absolute;display:block;top:0;height:100%;width:1px;background:#ddd;left:-1px}.algolia-autocomplete .algolia-docsearch-suggestion--category-header{position:relative;border-bottom:1px solid #ddd;display:none;margin-top:8px;padding:4px 0;font-size:1em;color:#33363d}.algolia-autocomplete .algolia-docsearch-suggestion--wrapper{width:100%;float:left;padding:8px 0 0}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column{float:left;width:30%;text-align:right;position:relative;padding:5.33333px 10.66667px;color:#a4a7ae;font-size:.9em;word-wrap:break-word}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column:before{content:"";position:absolute;display:block;top:0;height:100%;width:1px;background:#ddd;right:0}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-inline{display:none}.algolia-autocomplete .algolia-docsearch-suggestion--title{margin-bottom:4px;color:#02060c;font-size:.9em;font-weight:700}.algolia-autocomplete .algolia-docsearch-suggestion--text{display:block;line-height:1.2em;font-size:.85em;color:#63676d}.algolia-autocomplete .algolia-docsearch-suggestion--no-results{width:100%;padding:8px 0;text-align:center;font-size:1.2em}.algolia-autocomplete .algolia-docsearch-suggestion--no-results:before{display:none}.algolia-autocomplete .algolia-docsearch-suggestion code{padding:1px 5px;font-size:90%;border:none;color:#222;background-color:#ebebeb;border-radius:3px;font-family:Menlo,Monaco,Consolas,Courier New,monospace}.algolia-autocomplete .algolia-docsearch-suggestion code .algolia-docsearch-suggestion--highlight{background:none}.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header,.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary{display:block}@media (min-width:768px){.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{display:block}}@media (max-width:768px){.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{display:inline-block;width:auto;float:left;padding:0;color:#02060c;font-size:.9em;font-weight:700;text-align:left;opacity:.5}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:before{display:none}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:after{content:"|"}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content{display:inline-block;width:auto;text-align:left;float:left;padding:0}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content:before{display:none}}.algolia-autocomplete .suggestion-layout-simple.algolia-docsearch-suggestion{border-bottom:1px solid #eee;padding:8px;margin:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--content{width:100%;padding:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--content:before{display:none}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header{margin:0;padding:0;display:block;width:100%;border:none}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl0,.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl1{opacity:.6;font-size:.85em}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl1:before{background-image:url('data:image/svg+xml;utf8,');content:"";width:10px;height:10px;display:inline-block}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--wrapper{width:100%;float:left;margin:0;padding:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--duplicate-content,.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--subcategory-inline{display:none!important}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--title{margin:0;color:#458ee1;font-size:.9em;font-weight:400}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--title:before{content:"#";font-weight:700;color:#458ee1;display:inline-block}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--text{margin:4px 0 0;display:block;line-height:1.4em;padding:5.33333px 8px;background:#f8f8f8;font-size:.85em;opacity:.8}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight{color:#3f4145;font-weight:700;box-shadow:none}.algolia-autocomplete .algolia-docsearch-footer{width:134px;height:20px;z-index:2000;margin-top:10.66667px;float:right;font-size:0;line-height:0}.algolia-autocomplete .algolia-docsearch-footer--logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='168' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M78.988.938h16.594a2.968 2.968 0 012.966 2.966V20.5a2.967 2.967 0 01-2.966 2.964H78.988a2.967 2.967 0 01-2.966-2.964V3.897A2.961 2.961 0 0178.988.938zm41.937 17.866c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 00-1.574-.199 5.7 5.7 0 00-.897.069 2.699 2.699 0 00-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 01-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 01-1.471-.636 3.085 3.085 0 01-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 011.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 011.82-.185 8.404 8.404 0 011.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 00-.384-.73 1.784 1.784 0 00-.724-.493 3.164 3.164 0 00-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 00-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 012.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 00-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 00-.814.24 1.46 1.46 0 00-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 01.233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 01-1.471-.635 3.085 3.085 0 01-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 012.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 00-.109-.875 1.873 1.873 0 00-.384-.731 1.784 1.784 0 00-.724-.492 3.165 3.165 0 00-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 00-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 012.073-.177zm-8.034-1.271a1.626 1.626 0 01-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 01-1.128 1.906 4.986 4.986 0 01-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 01-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 01-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 011.15-1.892 5.133 5.133 0 011.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 011.753 1.216 5.644 5.644 0 011.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 00-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 01-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 01-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 012.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17z' fill='%235468FF'/%3E%3Cpath d='M6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 00-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 01-.582-.271 13.67 13.67 0 01-.55-.287 4.275 4.275 0 01-.567-.351 6.92 6.92 0 01-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 01-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 00-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 00-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 00-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 01-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z' fill='%235D6494'/%3E%3Cpath d='M89.632 5.967v-.772a.978.978 0 00-.978-.977h-2.28a.978.978 0 00-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 011.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 00-1.382 0l-.465.465a.973.973 0 000 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 00-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 01-4.49-4.482 4.488 4.488 0 014.49-4.482 4.488 4.488 0 014.489 4.482 4.484 4.484 0 01-4.49 4.482m0-10.85a6.363 6.363 0 100 12.729 6.37 6.37 0 006.372-6.368 6.358 6.358 0 00-6.371-6.36' fill='%23FFF'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-position:50%;background-size:100%;overflow:hidden;text-indent:-9000px;padding:0!important;width:100%;height:100%;display:block}.friend-link-wrapper[data-v-120fcf04]{position:relative;margin:30px 0}.friend-link-wrapper .friend-link-item[data-v-120fcf04]{position:relative;vertical-align:middle;margin:4px 4px 10px;padding:4px 8px 4px 20px;line-height:20px;display:inline-block;cursor:default;border-radius:.25rem;font-size:13px;box-shadow:var(--box-shadow);transition:all .5s}.friend-link-wrapper .friend-link-item .list-style[data-v-120fcf04]{position:absolute;left:.4rem;top:0;bottom:0;margin:auto;display:block;width:.4rem;height:.4rem;border-radius:.1rem;background:#3eaf7c;content:""}.friend-link-wrapper .friend-link-item .popup-window-wrapper[data-v-120fcf04]{display:none}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window[data-v-120fcf04]{position:absolute;display:flex;background:var(--background-color);box-shadow:var(--box-shadow);border-radius:.25rem;box-sizing:border-box;padding:.8rem 1rem;width:280px}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .logo[data-v-120fcf04]{margin-right:.4rem;width:2rem;height:2rem;flex:0 0 2rem;border-radius:.25rem;overflow:hidden}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .logo img[data-v-120fcf04]{width:2rem;height:2rem}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .info[data-v-120fcf04]{flex:0 0 85%;width:85%}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .info .title[data-v-120fcf04]{display:flex;align-items:center;justify-content:space-between;height:2rem}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .info .title h4[data-v-120fcf04]{margin:.2rem 0;flex:0 0 86%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .info .title .btn-go[data-v-120fcf04]{width:1.4rem;height:1.2rem;border-radius:.25rem;font-size:12px;color:#fff;text-align:center;line-height:1.2rem;cursor:pointer;transition:all .5s}.friend-link-wrapper .friend-link-item .popup-window-wrapper .popup-window .info .title .btn-go[data-v-120fcf04]:hover{transform:scale(1.1)}.fade-enter-active[data-v-120fcf04],.fade-leave-active[data-v-120fcf04]{transition:opacity .5s}.fade-enter[data-v-120fcf04],.fade-leave-to[data-v-120fcf04]{opacity:0}.footer-wrapper[data-v-29dae040]{padding:1.5rem 2.5rem;border-top:1px solid var(--border-color);text-align:center;color:#5b5b5b}.footer-wrapper a[data-v-29dae040]{font-size:14px}.footer-wrapper>span[data-v-29dae040]{margin-left:1rem}.footer-wrapper>span>i[data-v-29dae040]{margin-right:.5rem}.footer-wrapper .cyber-security img[data-v-29dae040]{margin-right:.5rem;width:20px;height:20px;vertical-align:middle}.footer-wrapper .cyber-security a[data-v-29dae040]{vertical-align:middle}@media (max-width:719px){.footer[data-v-29dae040]{text-align:left!important}.footer>span[data-v-29dae040]{display:block;margin-left:0;line-height:2rem}}.search-box{display:inline-block;position:relative;margin-right:1rem}.search-box .iconfont{position:absolute;top:0;bottom:0;z-index:0;left:.6rem;margin:auto}.search-box input{cursor:text;width:10rem;height:2rem;color:#5b5b5b;display:inline-block;border:1px solid var(--border-color);border-radius:.25rem;font-size:.9rem;line-height:2rem;padding:0 .5rem 0 2rem;outline:none;transition:all .2s ease;background:transparent;background-size:1rem}.search-box input:focus{cursor:auto;border-color:#3eaf7c}.search-box .suggestions{background:var(--background-color);width:20rem;position:absolute;top:1.5rem;border:1px solid #cfd4db;border-radius:6px;padding:.4rem;list-style-type:none}.search-box .suggestions.align-right{right:0}.search-box .suggestion{line-height:1.4;padding:.4rem .6rem;border-radius:4px;cursor:pointer}.search-box .suggestion a{white-space:normal;color:var(--text-color)}.search-box .suggestion a .page-title{font-weight:600}.search-box .suggestion a .header{font-size:.9em;margin-left:.25em}.search-box .suggestion.focused{background-color:var(--border-color)}.search-box .suggestion.focused a{color:#3eaf7c}@media (max-width:959px){.search-box input{cursor:pointer;width:0;border-color:transparent;position:relative}.search-box input:focus{cursor:text;left:0;width:10rem}}@media (-ms-high-contrast:none){.search-box input{height:2rem}}@media (max-width:959px) and (min-width:719px){.search-box{margin-right:0}.search-box .suggestions{left:0}}@media (max-width:719px){.search-box{margin-right:0}.search-box .suggestions{right:0}}@media (max-width:419px){.search-box .suggestions{width:calc(100vw - 4rem)}.search-box input:focus{width:8rem}}.sidebar-button{cursor:pointer;display:none;width:1.25rem;height:1.25rem;position:absolute;padding:.6rem;top:.6rem;left:1rem}.sidebar-button .icon{display:block;width:1.25rem;height:1.25rem}@media (max-width:719px){.sidebar-button{display:block}}.dropdown-enter,.dropdown-leave-to{height:0!important}.dropdown-wrapper{cursor:pointer}.dropdown-wrapper .dropdown-title{display:block}.dropdown-wrapper .dropdown-title:hover{border-color:transparent}.dropdown-wrapper .dropdown-title .arrow{vertical-align:middle;margin-top:-1px;margin-left:.4rem}.dropdown-wrapper .nav-dropdown .dropdown-item{color:inherit;line-height:1.7rem}.dropdown-wrapper .nav-dropdown .dropdown-item h4{margin:.45rem 0 0;border-top:1px solid var(--border-color);padding:.45rem 1.5rem 0 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper{padding:0;list-style:none}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper .dropdown-subitem{font-size:.9em}.dropdown-wrapper .nav-dropdown .dropdown-item a{display:block;line-height:1.7rem;position:relative;border-bottom:none;font-weight:400;margin-bottom:0;padding:0 1.5rem 0 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:#3eaf7c}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{content:"";width:0;height:0;border-left:5px solid #3eaf7c;border-top:3px solid transparent;border-bottom:3px solid transparent;position:absolute;top:calc(50% - 2px);left:9px}.dropdown-wrapper .nav-dropdown .dropdown-item:first-child h4{margin-top:0;padding-top:0;border-top:0}@media (max-width:719px){.dropdown-wrapper.open .dropdown-title{margin-bottom:.5rem}.dropdown-wrapper .nav-dropdown{transition:height .1s ease-out;overflow:hidden}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top:0;margin-top:0;padding-top:0}.dropdown-wrapper .nav-dropdown .dropdown-item>a,.dropdown-wrapper .nav-dropdown .dropdown-item h4{font-size:15px;line-height:2rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem{font-size:14px;padding-left:1rem}}@media (min-width:719px){.dropdown-wrapper{height:1.8rem}.dropdown-wrapper:hover .nav-dropdown{display:block!important}.dropdown-wrapper .dropdown-title .arrow{border-left:4px solid transparent;border-right:4px solid transparent;border-top:6px solid var(--text-color-sub);border-bottom:0}.dropdown-wrapper .nav-dropdown{display:none;height:auto!important;box-sizing:border-box;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;background-color:var(--background-color);padding:.6rem 0;box-shadow:var(--box-shadow);text-align:left;border-radius:.25rem;white-space:nowrap;margin:0}}.mode-options{background-color:var(--background-color);min-width:125px;margin:0;padding:1em;box-shadow:var(--box-shadow);border-radius:.25rem}.mode-options .title{margin-top:0;margin-bottom:.6rem;font-weight:700;color:var(--text-color)}.mode-options .color-mode-options{display:flex;flex-wrap:wrap}.mode-options .color-mode-options li{flex:1;text-align:center;font-size:12px;color:var(--text-color);line-height:18px;padding:3px 6px;border-top:1px solid #666;border-bottom:1px solid #666;background-color:var(--background-color);cursor:pointer}.mode-options .color-mode-options li.dark{border-radius:.25rem 0 0 .25rem;border-left:1px solid #666}.mode-options .color-mode-options li.light{border-radius:0 .25rem .25rem 0;border-right:1px solid #666}.mode-options .color-mode-options li.active{background-color:#3eaf7c;color:#fff}.mode-options .color-mode-options li:not(.active){border-right:1px solid #666}.color-picker{position:relative;margin-right:1em;cursor:pointer}.color-picker .color-button{align-items:center;height:100%}.color-picker .color-button .iconfont{font-size:1.4rem;color:#3eaf7c}.color-picker .color-picker-menu{position:absolute;top:40px;left:50%;z-index:150}.color-picker .color-picker-menu ul{list-style-type:none;margin:0;padding:0}@media (max-width:719px){.color-picker{margin-right:1rem}.color-picker .color-picker-menu{left:calc(50% - 35px)}.color-picker .color-picker-menu:before{left:calc(50% + 35px)}}.nav-links{display:inline-block}.nav-links a{line-height:1.4rem;color:var(--text-color)}.nav-links a.router-link-active,.nav-links a.router-link-active .iconfont,.nav-links a:hover,.nav-links a:hover .iconfont{color:#3eaf7c}.nav-links .nav-item{position:relative;display:inline-block;margin-left:1.5rem;line-height:2rem}.nav-links .nav-item:first-child{margin-left:0}.nav-links .repo-link{margin-left:1.5rem}@media (max-width:719px){.nav-links .nav-item,.nav-links .repo-link{margin-left:0}}@media (min-width:719px){.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{margin-bottom:-2px}}.navbar{padding:.7rem 1.5rem;line-height:2.2rem;box-shadow:var(--box-shadow);background:var(--background-color)}.navbar a,.navbar img,.navbar span{display:inline-block}.navbar .logo{height:2.2rem;min-width:2.2rem;margin-right:.8rem;vertical-align:top;border-radius:50%}.navbar .site-name{font-size:1.2rem;font-weight:600;color:var(--text-color);position:relative}.navbar .links{padding-left:1.5rem;box-sizing:border-box;white-space:nowrap;font-size:.9rem;position:absolute;right:1.5rem;top:.7rem;display:flex;background-color:var(--background-color)}.navbar .links .search-box{flex:0 0 auto;vertical-align:top}@media (max-width:719px){.navbar{padding-left:4rem}.navbar .can-hide{display:none}.navbar .links{padding-left:.2rem}}.personal-info-wrapper .personal-img[data-v-1fad0c41]{display:block;margin:2rem auto 1rem;width:6rem;height:6rem;border-radius:50%}.personal-info-wrapper .name[data-v-1fad0c41]{font-size:1rem;text-align:center;color:var(--text-color)}.personal-info-wrapper .num[data-v-1fad0c41]{display:flex;margin:0 auto 1rem;width:80%}.personal-info-wrapper .num>div[data-v-1fad0c41]{text-align:center;flex:0 0 50%}.personal-info-wrapper .num>div[data-v-1fad0c41]:first-child{border-right:1px solid #333}.personal-info-wrapper .num>div h3[data-v-1fad0c41]{line-height:auto;margin:0 0 .6rem;color:var(--text-color)}.personal-info-wrapper .num>div h6[data-v-1fad0c41]{line-height:auto;color:var(--text-color);margin:0}.personal-info-wrapper .social-links[data-v-1fad0c41]{box-sizing:border-box;display:flex;flex-wrap:wrap;padding:10px}.personal-info-wrapper .social-links .social-item[data-v-1fad0c41]{width:39px;height:36px;line-height:36px;text-align:center;list-style:none;transition:transform .3s}.personal-info-wrapper .social-links .social-item[data-v-1fad0c41]:hover{transform:scale(1.08)}.personal-info-wrapper .social-links .social-item i[data-v-1fad0c41]{cursor:pointer;font-size:22px}.sidebar-group{background:var(--background-color)}.sidebar-group .sidebar-group{padding-left:.5em}.sidebar-group:not(.collapsable) .sidebar-heading:not(.clickable){cursor:auto;color:var(--text-color)}.sidebar-group.is-sub-group{padding-left:0}.sidebar-group.is-sub-group>.sidebar-heading{font-size:.95em;line-height:1.4;font-weight:400;padding-left:2rem}.sidebar-group.is-sub-group>.sidebar-heading:not(.clickable){opacity:.5}.sidebar-group.is-sub-group>.sidebar-group-items{padding-left:1rem}.sidebar-group.is-sub-group>.sidebar-group-items>li>.sidebar-link{font-size:.95em;border-left:none}.sidebar-group.depth-2>.sidebar-heading{border-left:none}.sidebar-heading{position:relative;color:var(--text-color);transition:color .15s ease;cursor:pointer;font-size:1em;font-weight:500;padding:.35rem 1.5rem .35rem 1.25rem;width:100%;box-sizing:border-box;margin:0}.sidebar-heading.open,.sidebar-heading:hover{color:#3eaf7c}.sidebar-heading .arrow{position:absolute;top:0;bottom:0;right:1em;margin:auto}.sidebar-heading.clickable.active{font-weight:600;color:#3eaf7c;border-left-color:#3eaf7c}.sidebar-heading.clickable:hover{color:#3eaf7c}.sidebar-group-items{transition:height .1s ease-out;font-size:.95em;overflow:hidden}.sidebar .sidebar-sub-headers{padding-left:1.5rem;font-size:.95em}.sidebar-sub-headers a.sidebar-link{margin:0 1rem 0 .6rem}a.sidebar-link{font-size:1em;font-weight:400;display:block!important;color:var(--text-color);padding:.35rem 1rem .35rem 2.25rem;line-height:1.7;background:var(--background-color);box-sizing:border-box}a.sidebar-link:hover{color:#3eaf7c}a.sidebar-link.active{font-weight:600;color:#3eaf7c;background:var(--default-color-8);border-right:3px solid #3eaf7c}.sidebar-sub-headers a.sidebar-link{padding-top:.25rem;padding-bottom:.25rem;border-left:none}.sidebar-sub-headers a.sidebar-link.active{font-weight:500;background:transparent;color:#3eaf7c}.iconfont[data-v-8a445198]{display:inline-block;line-height:1.5rem}.iconfont[data-v-8a445198]:not(:last-child){margin-right:1rem}.iconfont span[data-v-8a445198]{margin-left:.5rem}.tags .tag-item[data-v-8a445198]{font-family:Ubuntu,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;cursor:pointer}.tags .tag-item.active[data-v-8a445198],.tags .tag-item[data-v-8a445198]:hover{color:#3eaf7c}@media (max-width:719px){.tags[data-v-8a445198]{display:block;margin-left:0!important}}.page-nav,.page .comments-wrapper,.page .page-edit{max-width:860px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-nav,.page .comments-wrapper,.page .page-edit{padding:2rem}}@media (max-width:419px){.page-nav,.page .comments-wrapper,.page .page-edit{padding:1.5rem}}.page{position:relative;padding-top:5rem;padding-bottom:2rem;padding-right:14rem;display:block}.page .page-title{max-width:860px;margin:0 auto;padding:1rem 2.5rem;color:var(--text-color)}.page .theme-reco-content h2{position:relative;padding-left:.8rem}.page .theme-reco-content h2:before{position:absolute;left:0;top:3.5rem;display:block;height:1.8rem;content:"";border-left:5px solid #3eaf7c}.page .page-edit{padding-top:1rem;padding-bottom:1rem;overflow:auto}.page .page-edit .edit-link{display:inline-block}.page .page-edit .edit-link a{color:#3eaf7c;margin-right:.25rem}.page .page-edit .last-updated{float:right;font-size:.9em}.page .page-edit .last-updated .prefix{font-weight:500;color:#3eaf7c}.page .page-edit .last-updated .time{font-weight:400;color:#aaa}.page-nav{padding-top:1rem;padding-bottom:0}.page-nav .inner{min-height:2rem;margin-top:0;border-top:1px solid var(--border-color);padding-top:1rem;overflow:auto}.page-nav .next{float:right}@media (max-width:719px){.page{padding-right:0}.page .page-title{padding:0 1rem}.page .page-edit .edit-link{margin-bottom:.5rem}.page .page-edit .last-updated{font-size:.8em;float:none;text-align:left}}.sidebar.sidebar::-webkit-scrollbar{width:0;height:0}.sidebar .personal-info-wrapper{display:none}.sidebar ul{padding:0;margin:0;list-style-type:none}.sidebar ul.sidebar-links>li{background:#3eaf7c}.sidebar a{display:inline-block}.sidebar .nav-links{display:none;border-bottom:1px solid var(--border-color);padding:.5rem 0 .75rem}.sidebar .nav-links a{font-weight:600}.sidebar .nav-links .nav-item,.sidebar .nav-links .repo-link{display:block;line-height:1.25rem;font-size:1.1em;padding:.5rem 0 .5rem 1.5rem}.sidebar>.sidebar-links{padding:1.5rem 0}.sidebar>.sidebar-links>li>a.sidebar-link{font-size:1em;line-height:1.7;font-weight:500}.sidebar>.sidebar-links>li:not(:first-child){margin-top:.75rem}@media (max-width:719px){.sidebar .nav-links,.sidebar .personal-info-wrapper{display:block}.sidebar .nav-links .dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{top:calc(1rem - 2px)}.sidebar>.sidebar-links{padding:1rem 0}}.password-shadow[data-v-59e6cb88]{overflow:hidden;position:relative;background:#fff;background:var(--background-color);box-sizing:border-box}.password-shadow .title[data-v-59e6cb88]{margin:8rem auto 2rem;width:100%;font-size:30px}.password-shadow .description[data-v-59e6cb88],.password-shadow .title[data-v-59e6cb88]{text-align:center;box-sizing:border-box;text-shadow:0 2px 4px rgba(0,0,0,.1);color:#242424;color:var(--text-color)}.password-shadow .description[data-v-59e6cb88]{margin:0 auto 6rem;font-size:22px;padding:0 10px}.password-shadow .inputBox[data-v-59e6cb88]{position:absolute;top:40%;left:0;right:0;margin:auto;display:block;max-width:700px;height:100px;background:#3eaf7c;border-radius:.25rem;padding-left:20px;box-sizing:border-box;opacity:.9}.password-shadow .inputBox input[data-v-59e6cb88]{width:570px;height:100%;border:none;padding:0 0 0 5px;color:#fff;background:none;outline:none;position:absolute;bottom:0;left:20px;opacity:0;font-size:50px}.password-shadow .inputBox input[data-v-59e6cb88]:focus{opacity:1}.password-shadow .inputBox input:focus~span[data-v-59e6cb88]{transform:translateY(-80px);color:#3eaf7c;font-size:30px;opacity:.8}.password-shadow .inputBox input:focus~button[data-v-59e6cb88]{opacity:1;width:100px}.password-shadow .inputBox span[data-v-59e6cb88]{width:200px;height:100%;display:block;position:absolute;line-height:100px;top:0;left:20px;color:#fff;cursor:text;transition:.5s;transform-origin:left top;font-size:30px}.password-shadow .inputBox button[data-v-59e6cb88]{overflow:hidden;width:0;height:98px;border-radius:.25rem;position:absolute;background:var(--background-color);right:1px;top:1px;border:0;padding:0;color:#3eaf7c;font-size:18px;outline:none;cursor:pointer;opacity:0;transition:.5s;z-index:1}.password-shadow .footer[data-v-59e6cb88]{position:absolute;left:0;right:0;bottom:10%;padding:2.5rem;text-align:center;color:#5b5b5b}.password-shadow .footer>span[data-v-59e6cb88]{margin-left:1rem}.password-shadow .footer>span>i[data-v-59e6cb88]{margin-right:.5rem}@media (max-width:719px){.password-shadow .inputBox[data-v-59e6cb88]{max-width:700px;height:60px;background:#3eaf7c;border-radius:.25rem;position:absolute;left:0;right:0;top:43%;margin:auto 20px;padding-left:0;box-sizing:border-box;opacity:.9}.password-shadow .inputBox input[data-v-59e6cb88]{width:60%;height:100%;border:none;padding:0 0 0 5px;color:#fff;background:none;outline:none;position:absolute;bottom:0;opacity:0;font-size:30px}.password-shadow .inputBox input[data-v-59e6cb88]:focus{opacity:1}.password-shadow .inputBox input:focus~span[data-v-59e6cb88]{transform:translateY(-60px);color:#3eaf7c;font-size:20px;opacity:.8}.password-shadow .inputBox input:focus~button[data-v-59e6cb88]{opacity:1;width:60px}.password-shadow .inputBox span[data-v-59e6cb88]{width:200px;height:100%;display:block;position:absolute;line-height:60px;top:0;left:20px;color:#fff;cursor:text;transition:.5s;transform-origin:left top;font-size:20px}.password-shadow .inputBox button[data-v-59e6cb88]{width:0;height:58px;border-radius:.25rem;position:absolute;right:1px;top:1px;border:0;padding:0;background:#fff;color:#3eaf7c;font-size:18px;outline:none;cursor:pointer;opacity:0;transition:.5s;z-index:1}.password-shadow .footer[data-v-59e6cb88]{margin-left:0}}@media (max-width:959px){.password-shadow .footer[data-v-59e6cb88]{margin-left:0}}.abstract-item[data-v-73a63558]{position:relative;margin:0 auto 20px;padding:16px 20px;width:100%;overflow:hidden;border-radius:.25rem;box-shadow:var(--box-shadow);box-sizing:border-box;transition:all .3s;background-color:var(--background-color);cursor:pointer}.abstract-item>[data-v-73a63558]{pointer-events:auto}.abstract-item .reco-sticky[data-v-73a63558]{position:absolute;top:0;left:0;display:inline-block;color:#3eaf7c;font-size:2.4rem}.abstract-item[data-v-73a63558]:hover{box-shadow:var(--box-shadow-hover)}.abstract-item .title[data-v-73a63558]{position:relative;font-size:1.28rem;line-height:46px;display:inline-block}.abstract-item .title a[data-v-73a63558]{color:var(--text-color)}.abstract-item .title .reco-lock[data-v-73a63558]{font-size:1.28rem;color:#3eaf7c}.abstract-item .title[data-v-73a63558]:after{content:"";position:absolute;width:100%;height:2px;bottom:0;left:0;background-color:#3eaf7c;visibility:hidden;transform:scaleX(0);transition:.3s ease-in-out}.abstract-item .title:hover a[data-v-73a63558]{color:#3eaf7c}.abstract-item .title[data-v-73a63558]:hover:after{visibility:visible;transform:scaleX(1)}.abstract-item .tags .tag-item.active[data-v-73a63558],.abstract-item .tags .tag-item[data-v-73a63558]:hover{color:#3eaf7c}@media (max-width:719px){.tags[data-v-73a63558]{display:block;margin-top:1rem;margin-left:0!important}}.sub-sidebar-wrapper[data-v-b57cc07c]{width:12rem;padding-left:0;list-style:none;font-size:12px}.sub-sidebar-wrapper li[data-v-b57cc07c]{padding:.2rem 0;cursor:pointer;border-left:1px solid var(--border-color)}.sub-sidebar-wrapper li a[data-v-b57cc07c]{padding:.35rem 1rem .35rem 0;color:var(--text-color)}.sub-sidebar-wrapper li:hover a[data-v-b57cc07c]{color:#3eaf7c}.sub-sidebar-wrapper li.active[data-v-b57cc07c]{border-left:1px solid #3eaf7c}.sub-sidebar-wrapper li.active a[data-v-b57cc07c]{color:#3eaf7c}.sub-sidebar-wrapper li.level-1[data-v-b57cc07c]{padding-left:.4rem}.sub-sidebar-wrapper li.level-2[data-v-b57cc07c]{padding-left:.9rem}.sub-sidebar-wrapper li.level-3[data-v-b57cc07c]{padding-left:1.5rem}.tags[data-v-cbf58c6c]{margin:30px 0}.tags span[data-v-cbf58c6c]{vertical-align:middle;margin:4px 4px 10px;padding:4px 8px;display:inline-block;cursor:pointer;border-radius:.25rem;background:#fff;color:#fff;line-height:13px;font-size:13px;box-shadow:var(--box-shadow);transition:all .5s}.tags span[data-v-cbf58c6c]:hover{transform:scale(1.04)}.tags span.active[data-v-cbf58c6c]{transform:scale(1.2)}.abstract-wrapper[data-v-21a20f36]{width:100%}.home-blog{padding:0;margin:0 auto}.home-blog .hero{margin:3.6rem auto 0;position:relative;box-sizing:border-box;padding:0 20px;height:100vh;display:flex;align-items:center;justify-content:center}.home-blog .hero .hero-img{max-width:300px;margin:0 auto 1.5rem}.home-blog .hero h1{display:block;margin:0 auto 1.8rem;font-size:2.5rem}.home-blog .hero .description{margin:1.8rem auto;font-size:1.6rem;line-height:1.3}.home-blog .home-blog-wrapper{display:flex;align-items:flex-start;margin:20px auto 0;padding:0 20px;max-width:1126px}.home-blog .home-blog-wrapper .blog-list{flex:auto;width:0}.home-blog .home-blog-wrapper .blog-list .abstract-wrapper .abstract-item:last-child{margin-bottom:0}.home-blog .home-blog-wrapper .info-wrapper{position:sticky;top:70px;overflow:hidden;transition:all .3s;margin-left:15px;flex:0 0 300px;height:auto;box-shadow:var(--box-shadow);border-radius:.25rem;box-sizing:border-box;padding:0 15px;background:var(--background-color)}.home-blog .home-blog-wrapper .info-wrapper:hover{box-shadow:var(--box-shadow-hover)}.home-blog .home-blog-wrapper .info-wrapper h4{color:var(--text-color)}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper{list-style:none;padding-left:0}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper .category-item{margin-bottom:.4rem;padding:.4rem .8rem;transition:all .5s;border-radius:.25rem;box-shadow:var(--box-shadow);background-color:var(--background-color)}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper .category-item:hover{transform:scale(1.04)}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper .category-item:hover a{color:#3eaf7c}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper .category-item a{display:flex;justify-content:space-between;align-items:center;color:var(--text-color)}.home-blog .home-blog-wrapper .info-wrapper .category-wrapper .category-item a .post-num{width:1.6rem;height:1.6rem;text-align:center;line-height:1.6rem;border-radius:.25rem;background:#eee;font-size:13px;color:#fff}@media (max-width:719px){.home-blog .hero{height:450px}.home-blog .hero img{max-height:210px;margin:2rem auto 1.2rem}.home-blog .hero h1{margin:0 auto 1.8rem;font-size:2rem}.home-blog .hero .description{font-size:1.2rem}.home-blog .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home-blog .home-blog-wrapper{display:block!important}.home-blog .home-blog-wrapper .blog-list{width:auto}.home-blog .home-blog-wrapper .info-wrapper{margin-left:0}.home-blog .home-blog-wrapper .info-wrapper .personal-info-wrapper{display:none}}@media (max-width:419px){.home-blog .hero{height:450px}.home-blog .hero img{max-height:210px;margin:2rem auto 1.2rem}.home-blog .hero h1{margin:0 auto 1.8rem;font-size:2rem}.home-blog .hero .description{font-size:1.2rem}.home-blog .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home-blog .home-blog-wrapper{display:block!important}.home-blog .home-blog-wrapper .blog-list{width:auto}.home-blog .home-blog-wrapper .info-wrapper{margin-left:0}.home-blog .home-blog-wrapper .info-wrapper .personal-info-wrapper{display:none}}.theme-container .sub-sidebar[data-v-7dd95ae2]{position:fixed;top:5rem;bottom:5rem;right:2rem;overflow-y:scroll}.theme-container .sub-sidebar[data-v-7dd95ae2]::-webkit-scrollbar{width:0;height:0}.theme-container .loading-wrapper[data-v-7dd95ae2]{position:absolute;z-index:22;top:0;bottom:0;left:0;right:0;margin:auto}.theme-container .password-wrapper-out[data-v-7dd95ae2]{position:absolute;z-index:21;top:0;bottom:0;left:0;right:0;margin:auto}.theme-container .password-wrapper-in[data-v-7dd95ae2]{position:absolute;z-index:8;top:0;bottom:0;left:0;right:0}.theme-container .hide[data-v-7dd95ae2]{height:100vh;overflow:hidden;opacity:0}.fade-enter-active[data-v-7dd95ae2],.fade-leave-active[data-v-7dd95ae2]{transition:opacity .5s ease-in-out .5s}.fade-enter[data-v-7dd95ae2],.fade-leave-to[data-v-7dd95ae2]{opacity:0}@media (max-width:719px){.theme-container .sub-sidebar[data-v-7dd95ae2]{display:none}}@font-face{font-family:iconfont;src:url(data:font/woff2;base64,d09GMgABAAAAACcIAAsAAAAARPAAACa6AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACKegrvONktATYCJAOBZAt0AAQgBYRnB4QOG604RaTdtJfiZP8fDugB82cnpUAl0ZGsRjJLjaLz7uhxFXN2ZOvr79/nQ9vQlsfQdlhwYIL57VuYrybm6PdDKXkefu3beTNfbMX8ryOe8ERJpE2URqJUIiWQCFnTRXR4fm7/5967DEZvrBmMGIwesaakR46UsRESreh/UiIiRoPPeJiA2YCJXzGywagXC4A2P3+HXwABBLn77T7wUDKLIGkLrEAC4J+qadm9EOi2d1N1A5JlWJAsW1rM2XwAMOA9HezyISTxp7vy66n8eqYFhgOJzbTIA4FXKq9s6fT0aMUvAyuANKXtRMvW23mZaqU6zi0Tw5Q23vptr7vAApSA5AiRvP//dJat5CPu7sIHCv4At4A9V+WMtDQaL0iLWoXsQ1kHkjdgb8iHWIUAPIvWoeQNSEE7BFzmpSKsrijqABVlnz66ibgowOCca6phdf0xpuk5fkypdQ1CeEMEI4o7artvj4KeMw9UD/WTDIByVVBXARw12EctxActVyWWAoB7rNQgDCg6ZS3apTaYF4Im1Wt4DABv/He+/AK+BQdUmjWwb9KLlzoTGHkJfViztVn9EYyyS4GWKzRRYyhYVfWBPLy8B0hoDtV6uOc6qvQAHlNCawWBR8LEISQmISXjJ5SWgVGuyUrMMDeFLGY5917+07iZev163s//v0vf7P/DZQ0EjYiCzWLr7rzJKWh2p0XT9LZbLx6LkcwgVz7a+mQmZsVKd3uFmv8oD9gwsGTRvOu2TFswal/LulPjZnTc0HXpwpS2ngm3nLlmU9O5STfVRuxadWTNnKFjy1bsGFMpZm07dGJPw4E+pQXgwAOo3hljbxHIATYIDAwIAiwRNLBIMMA8wQLXCQ7YInhgmhCBBUISjBJgn1CBFqEB64QOnBKGjBRmAjBD2ECHcIAbRAh0iRi4JBLggrjLWIWlALSJN9AjMmCCyCWZhf1ARgorQJYPhwKwSTRAk2iBc2IAJokRuElygZpMBkaIBdglxcAqKQGOSBOwRqYDc2QGMCRzgWOyEVgmB4AVcgjYIZeBMfIPUPENkvlhLihmIWwCxTaEXwNwyPd5wAk/3wB7/EoHGvybDRzwf/gQ+uC2u4RXgK8ATD4Cc8/tqvLWqNRcEfSiRslNlbaG2rG3VTqm3H0asCZNBZZoRLEMEXrBmkK8d6rdIjZUAAVSQRlc1jsjbnPaE6rIS+p5G6dJTVqVOXsQUpvy92EjrBrbTZnFUcovjVlU07yvVkUvyILIWjbGTjE15IcmTH7iWTjjLN7XRyfYxvk1j7tt3nIJ34N8WKtypUr2W/+WyR96N+o6rjsVXdHtrRvHa+xjkx0FhQujRkY5Z6PlBdrWHLZVCZQ23j66QcCb1yVGymsWkDq3fWU/TfOECSL9/ppFOX2lI5tI5Y48a11IOFRYsh0rWPGSKiyDlFmV1qyKHjwoJt1gbVW/y9RJxarRKmJ5yXC4pM25bVW2BkhF5oB4nhUEkCqiZhLN9f7M8PtTM+hv6d6Iz5jrkp8N1PdPUEj3/do847+y8MIVhNhzlzquuUeG9vwMANn7S9O09/L885cxtl682n0zeHR0/2/wOPN9GgSW5xHXTYl0N5LyOQ0bp3axe2AHuY93Ww/hztEH7xtIQyl87DP6AO1iZVLBu3eIzIY7Bx30J1YGBPzVLnj7rJKaqtPQe7tTInuCU4n7W/shcwGmyRq21gFpk9wpADCkk/FNdRJSf+CyoiTcfFHH7szA7XT2JsY0CyENXt3pLe/oNABE4hK2bl8NtpGpa2eBAPmFqzA3scKWxsh4il64w25tAVCv/fGRv2CAITYMUA8Hd7FrU2AHmb4uoMPNWbiTztz4C2IbdBOLcWSyZsbbxL2MulB9ax/ttu6D4ydHH2rbmoW1/ThXPiPjsUJcoAAl9UwQueu/k9hI3Olb6Zh7zH3t1gc2kTQu1/NBNYVlJDydNDe7VztjevmxWz1e73L3Yr+uk642Z4rh5NPyS5o5JfdrotpBR5QKiZLR70dmbZpRbcj+9oOdlnheGWzNzPTB9+wBfWjdJ/fqEXOgH8Tw4iAV2NORTjjGyQakvBdYzX2EAbFxKWYJCJiDxVlqLSmoUn0n4QgZW7pDFlIHMYNx8AnGesYwcgoUtDb0ApOBwzubSeU2TuR1XbZljvHCASAYFz60MLbaM2AHacsrmpLIiqolS1h4xXUtxfMsJQgszfc/vvFoR5fhSCz7QiUjaacGeF5CxZFIitZKhcyQrnV0EeyGUx2tLVaElIdVssAqsAosbKlnwTCN5OB2zKkDnWhoeIFRkRRCjum5fKlqsyOwVRKRCFKFU2RcGtqKSoDYIq6WZNsDBKEzNjEvqhBqJFUXtu1CzMJ4m8QRCmfeI7atipvJmsA43HQxI5ul2KLDL14YzTlFhKT0VpTzAWBa8RKDkhodRyGs03keIYhDnJvArxxknFLCNbVqQGltlL/Ud+o4SLMIdZVzvVUAgLguqmNFuJ0GQY6vkLJ5TvfANmJLQaTF47MJiStOJDfSeuWlap5KT0+/fv35y2bwavDkZMtoYuKFouKoQs1NtDLlilmMctmO2YWMlM4UVAFHL3Q5SJ/wX4DFaD7EMzIuxK3r69OApCWYTLRL6qh/6PQlP7iA8/Luus8ZxWtbocx4ZT4u8GLQkp2oLkR17iiQCmHLBHCu8ariQFGTReW1uXQ5ZctNbzo3ThFvjj5skCfRALYAaE2z5L3RfZIF9gKJr3OpHM1HeVRiCDHY0GzsG2mmaimOhQ0IyIR1EB/tLFSO+kY8boFw6otMUZr9XMy+bssGup6RZWJagEnrzIGGwNgCMthbWEknsMPkrs6BvLAuxxfNXVEtuTPYjuiUtX4+jjG/j+iASD8fGOu59dxc60KfsnJoZv9vj07214JOQADoDFsbl9K/tC9KH8/V1UmYwiQMM+HxXrkSs9Vqm56vgfmwPSSle7gk4T1IFRExmazVFMdBjEdwwq84OVXU4mL+uH1UnhamiTVkOBh/ARDQmzTni+7Zi/SZZyjGB8dF8jC2iEueftpG6NAEP3CgDuLxmO69yy8uJkuTIw1Oa3opomIH45IuVJPKuCAXKkMrbdMcGQwpV56ba8sPx5RQk22bS3seFbtaG+WykbjIZR8QUURUgUtkhnxKw6YQKhYMHO2QFsIto5HRia5iR/5z9rVgCmstNjijaglbsViLUlR8tzE9fh0XulVL1H3Kmv9WaKYua4amm68fP3ns7Jtnzr3+GXTmpPTwPAcOeqFGWx0m8XRGd/IjxVZSRVbn/rHLVfPqa3ufdbVqLY3r2VEU35gJ3nxoBp53VEbstVtHpo6GT1zsC4zbspzhfX1R1/CfuLBvJAheDF6+7nmNU3wu9gNeTQwdKFTI0iXErrTm3YwrkNbi1eZ0WXGCwzk1CA1D60un0g6Peyq3GLQNbUcQQ3p4E2OwhbnUOAD4s9TZxMX9kLz0ykLf/ItXk75RiC8kqvsKseJM80jk/suePnJ4Muicb1/sH+pZjKfbuGKomPY/CwpMrDipINSBdYhLSEyHXE3iJVXlra21YC+EeIhLELsHQmNtY69JXLbji/Ha4dlH9Sks2waj7beW1DZ81MTbB5D2Z7Qdn6sHdaJLpmRKpmb4xwtLTvCzEp7ZBXG2wWloePW8jnMtk5GXeagcmpjl4/c63pbYCszWjqXTobEDBknWkpORXAPX6bHxrLws2+2FUPpEeilRPmEw861O0VFhbykuVNR0VoKBr+F0FAMEdAe7pB7C+kuH0h3XjLnEIt+RSE7FUhoQOYMhgvhQzSzX2cLuwNrhnKtYl4pytXu2KYlZD1v+lNmK3TS81zuJymMIQ7EznrZkO9yOotFEgl7V0XMiL+bufrldf4pLHZck1Gyqh4X63HOoGZtXVdpsdGMdx+Mq0CSud0QN/CLWTVXcGwXpykUKsc7+mlAg0i5JPC0VWyFVTSowP0zLNPHeniVZx00dm1c8cUZf69DTPCvRloGYjzjWo8hA7LkOqdnEUI2rGBBbNUsYN0maTMJNJlXUwN1C1ClUehaCdALlyxKXQeR5H27CuZvYOrgOzpYqpIxYMUtzJV2hJ7ldsn+OLZtw9BSl4kydq+L63IxG3JxZ6V3GVrwGqTJdPXTKSqKamID0zbvY6rzcC7Sqj9gSidmdsevty+EKINotxPwn4BfUTOWRacUM+uYmtl6mygaxUBroi1hjXd62cxQS29o6oZSd+6RZfpWJnmJLoXu1hBv+vp/dl1zNSfZ+uH6KTHMjzubkH2YQs4Ct1Vk6s/IXni9Wc6VC5Rvmv/MAwkgOxU8G2PJ6V926g5kwmpDD5K177jlezG6kmioPnj7rZNWUUEXr1x6rD6+mbqd/qgZJc3ttanxu4bhMKJIP+SII7cIkD/ZHTlE6ztOyXVBPidwXJ5GaZrOT3sX4VGlxeRz8jpSXFj7CVnfI6FiSZJpivpKWtGERcbI59YokoxhavtVIxQu19BlD+UHDblvTfzk6rnu2gOp/Fls3Iw3Z46ytHBoLDXmvL+u3X74urqx9/4PlVxf7a/3weDgjV8ziGz5Pg3R4HUwudBYCyF7xz93lWBDkoaHG9Ogek4mtCjNomd0fnGGaG11yuTeDKKuHZcaA2ezp5c7r3aXkRq7pk7S9ci57KJuoKuypDliyK9vBm0H/3eA7wynmeTqzVSbmYoCTcdKX//vHCY/iENq9l66xV268s91uY9DapBtsjawbQVfUVWt0zvovIC5CO8WSdaZZQ8z/e/DXv1lesAH45y/e477BevI9vTymLPQVE9OjZc49UL3T0Qk9gekbkAbu9Mliu91ekQvxUsto80hiy8YsNqYB8f5WbONt5abtaLF5JEhOBi+WmjKNxE0hMr5srU7SvdbMJ1JTus40ii51XEPMuLPXxIqtzrdPPRFJ4/kRQld2sI3al63+kioKhxnbIIVGduXNXpYkyKV0vZxXGhoAVRSniJjkIAkiRdc0Tij3L6jbcOGRN6ak4u024k1BB8lTW81J0eEz9swF+uzF2ZviPehJnj4PTu6ZF0YgpX1Ea4opKhy3a85AIjLoMIm5CUiTLbl4Iddmn5TrXK+uH02Yo5AajjHCHyD3Dlp04AhOrWP3zaJ32Nrv//DIH/+CdqIddTt3/1UzbgmbclwmwDrGp/S/LUO1CM5NI7Bu4md1oG6UiHf5RyZlM44NOsrMoQ1Qcmr0gn+rceC9EfVhNR0zsnfcrfCxuTU5MpoyYU8P1wvV7AP128m/FPQhUIUK4dyVlarS7KwU1Zv6eXM06fuQvuubJa8iX7WeF7Ug5h25D4irrQNAhohh4+A/sBnrfOYGGRRy8iqx2K9ZtYFGhFUZLpusqsDDZ6SaralnVAKSlUxCr4/1UyQSH2yA+g842gWrEP7YQgFgb5f83ZrL/CeuuS4nIp1o4lN7+/7x1i1oaSYepBuojq2BbWRdOke3CU+mt2vndp3yMGicdBbYnHS6HOJyBmPLLlanYz/+iEuWZuF2eq8+NiKU7OmpSxQO5zxVwODx/FLb6TJpP1Oxkudqk5HUTy3u0YHypSsbv/62uYyMnj7W91fhDz6Bzws0eBkCeXxCKp4/tixVlrpsjI9fns7sFaOa04zwyfI/iQPfl/480X4XZ56JxewVDYgHmKScrAp7mQnhrzoeb/+CIec7MKSvPCneEQkVnq3lnsoEb5rilfMeqCm0WFFUpCgO/UokNOic9dfnRGC1c9NJJLpkIpUnh9mtXYGjVrhK39JjY+nbd9dUeFVM3j30POCt1LUQO2Bo9+QhNbu382LSiKecvaQsDQ8vbSZSeXNo7tlkZ/VCFnDqbfyddW6Rv5rCh4RrLcCfwqNZmdDJGR4zLmFg4uHHKYpNT+GDvIqaz8qn7t1HxbBsqb0gFPHjwg0kOhmBcUw+x0QtJXIIk545C++e9eVGSoDzc2CNaLKEmhQKU6jlK5DQHL0l9GvuH6tmb0yaITZOinHyFOh5DqxpquClEnwc3j6A/GawxSc8QR/fxrrneV/63uM++B3zncO9wcnhXee4cDA5GJ8whcUrPiLMorj6NcKdjiEEcjjc6y45wlscrUMxo1PYySjeIRNaemS9vbL+0T9EcdeirsWJjBTA6tFpA+htFRcUF4pnz35WrR3VAt/1EQZu5XfuQu73Sm4YcbmGVbR4Bc+hm+P58ns/fnTg+/AdtMobilgC3f7D/VcJEkHvvTGRSjj8OR9UxMdv93ahWjQmUgu37321YQM4Npmyx91ocwI/ixSfKHOvrHzMhqpUXZ/Oc6JX7fMbj/RGPi4M3CrYqtdU9rP5R7X6w0Kd9pzgvF67RdAhGNNoxgQ6XXov+kHBbDCm1w3yV+SG+3VDvyqvT4H9I7T1rw9e9sps9w1186fP2Lh5jH9uq+Bob89KuS/0P88L3n65ywcRm8be3i2CwTFwbn8SvVdA/2uwh+8yMtgr8O1NVRZpNUuWyxMUr9X6VdTB8xP9IABRjkgaJU53i5UmooeCqcOfx6PjE9vbE+PR+KN4HeE+YQo6OygzICAzKBs9hXDhlA4/hkd3aKs1lRWaGm0HOilS5KYJqfKZIuvv957iU4k0ES6AR/5QAUaL2TmClWMobDriw5tSjgAapkaD0z44D+Q2StiVi5FjqGy0HF2eBqLc7pKzoCqAEqCAAXFgkJ0dMLhxHFbvoyktk2Plfho5Ru6r09M1MA89gl5uVFis/c6Wky7hP6WVV136PV56cQuHGQekr8JcgOxZs7O6QqmsUAvZUSuU6lSa0xVHBcfYnnPmHDNXcxZe3yg3TjJX5M+ocDLmXqbYfi14HGnBr979Lfs62DWH7blNsLXC9vGNKLMwd+Z1zfknCFhnFue6GsXz5omNrrmXec3FxnnzjOJc18uYhPrWI7t3F/HF9ivtYv+CiM3ZvTMfAy9fYS08QFfaU65qOj5BE3YO8jIaf2N8jDvsvou5rnPeLxeq6x6JTxa9UJhEgAX8rnKDxFFwY+P50j6obXEYISplIT1gVFM/iy8QizuvUvE85Tcvmu8+qo1hlaPDK+wj2N2xZVEWDUlPQ21yY7AEzgFHymdJqp27iiA/biJcewuUB7tGluCPXDckiYLDO+w4oZhWp1mBs4BYPtpY5mmR9vVJLZ5lHw0JzTlbpGWeHzGO9DYUQQAEFOI46RTJSnrBYT5LpJL6/HzT0nz81ujMzuCg/Pyg4DlEQNID6aQ8zgSStQl/PYrNcUcWLDgSF50B13xTtx1W7yd2Fca61f3Bj7dR21+emP/rrBYbjf2/xjnueUcv22eSEIsuz7KNOtSOkilLNLUuWa6h8vHR317MDfxZ9xiGbfp87EaQlRSAgC/wswCHvsUIoLO1nSlsAs8FOJ7sa8EGHsAksRad2F/ioA7Bx/tG5/o2UkscX56Qg3z5fpfnj7NhCsJ6W66Uoa+qlF4IfCebS8xLXI6GsT0j/Q2DIHSnNvxJDQfA1I7xp1UcCAZmcNkDRagMoAuXQmjHPD1dWG8ozpUYRd23zXVHRbmSy5hJSAPD67n9KB2FClDWRiCITllSDSMq1NN+6t6QQzc79ZOvXnkCY1AIggqiL53q0wxBd49APjSMVkC1QavgRDBzzg0XWipJWQOhUYHk6QTMwsdCbEIUVr1MjeahCIuxKbZEPGJ3FUH8J6JtnkF0QFqmxLggaEqUc9uzq3ZHpfZvgeHBn3soe903m5b85MQTBI2GN7GsUVUF6OfOc6A/pEY5QonjC+acdiFHUuJrJtCIq7YJ9F+X/bCJgbjBySgfFL6nmMSh+kPBzE1BgLwsEcNBuSEBLlJZZBRnCDs7hRli4zmxURWdnecxG8XnjKfImV1Sg6NkNjDgKBjh8JwY1BOwb8CVHt35jeNweeu5LzFUrTOWGqVfdkZ5bubtKaKt7lOSBrsdwO0GEg/oD/oj/IV7r7EqvJLmklxJlnhet/TV7qz+OFtQlHvJsWm4/1cI1+weOltkLoCPoshLZo7f3GAfy3qDRa9PrcDR9vK0Qbmn+Ff+YjLsMAkRVRKXmaNSHk8yPAJiEd/OoZ5fBsj8SdK9AWAFTBRTCLm68mR0F5pYDGtK4MgMSCJRq2lJauyTI1PO71/aaj1T0+ehcDm+BndGa2LLYJQAEczFkHEGbCIlcZGNgnksoFpJSpgPQdxBizCJwnQfvVNwpqDV460ykUGAmGrNemKaTfmbo0eCNjR0nLjuaOjALfrrL/UTtIC+K4A8G8VXUkawshWDtrgodiA3D8v/IdwDt2C6EeVE62UWOq0mft2dSiF1QhV52XehCjHJ5hqPjbKV6xbCyRCW3tDTrDaZDr1LUseH1qfp07T1uWN/ZdomaAwesz78KdPrRddPb9NBjA4csJ2+61qo4+apvYvDI3+6OdfZt92ad7+t88Dm0YHGJoXEUISe0j9nm5fh+lW42gfvyirh4fos2WgDy56lBko3W1W5uDV3cRI5ktQlLsxwDmclfH9+7gFVuSAFAiZ/xzxWN1OusYlk4vOpljH8xNvFMzVNUaIinqxKSGCb/mPedq53re15grmR2Njvorgk5E5xd5zBFV6S0in9loSX3yfWfVx8cNt2KFHdWZGgBurKOtRsKGlNWzAuvjev6moUd4euqt3dl5v9VUzuuP9kKmcpNRUatf6zeFJmpb+NxM2OFmACvKAHAeYccaa4q0uU6ZozRiQ0sUxxjnjM4OdyYl7cae5KzN7loCRtw5+5JlSfbNWD0QSv3+k4h7glGy82rWE8yI+9A5DfUXFqYQpqm543SVi/dK14/2iZ6VgVfUsff8ndvLuAGub2BzQD1sCFjSSKxANzuXbzIsKufa+HnpbRVDxljEjVRrM7b6hRwovQ7QfNCgewgpQub/XHnJIwoKQqWWH3eOBSu+kLFGEUlDrb8uqKcKvzhJ8xU1Ez4X9EES0DzPYBYPruVO/Ue2Ta1tcSEmJSmD8TqYEpxKL4bM5xoZ1Cfxo1K2r6xj3HT+iuD16/uQTntX7ahrIXz2sY9rqS9onYzrMVNyNWNbf+k1Txwg44Uuw93MhO/4UlCBJXenFyg+He86XXG04syrxDhyaJsmZlDtwtZZPxhyxh+9dT3gWyfGjciY0v6WJTs+TVqlIPNy7vI1ZXwSjxFd9tGnHNC8lbwROqY7psg0WFdbY/ZyJqSCYHk3RukG0cQYCn+LVxTHn3DStHo/gxfoyyF8NRiBZub7rluAWZZKNqunR2wfd9solNqY6v/5wWE0ikCWVZTFgX2MQIGkfFhdTOQ95ilK9p4jDxW/1gExQd/Qeh9Ij7P64outqyxb/YPaYTc7gZo1MS55tKY93eoLWkfMYhIC3FG8T2NgPo9uuLJUXMqd3dQeglQQa0HSEoBbXnxKIzFbj7mSk7eTaSI9cOwmhKHO2uunvL3CUdAOPvmoz4QeYbV5BocjEdt/bCGIihOeuXd3dD6r88uB3pCbMrudeeLLlxk56eT44JPk0mGHCYe6J1+gobLOOZ+ioej4VlMeTTKKzuRCkTR2Zmtthee1zoo8S8onEf7lxQ94ew8/+FO7l1jmBPgoJ0oPC2pyQtFP4Zw5ZfQTQ9BOV79zF7yoxbTq+mh3eFFYYBX7kgQawTbRFrxQlOc1tEOt/774lHbY4SXf3iwlMJCV7zyK7zxCOsI8SLhCM290HT9HfcNhE3Z6ELY2tX8L57AzcWtXwj0TzS/u0p8PtbGknxzmlTsYS8LPmCN4/ewrtZ/1K9spSehy1hZt4zij6ZDLZBmHEpmOr+GCotCH+TEvWGwc8bcXEaeeoJZXDjwdR4GVyZDLrdASAOMYeIwNcwaHSoX2RczIm6G0zCNscLdzwL0+KNyZWC1wlZev0qee0+jMlp8Z6Fdy74P9qk2vTIyT4HKo5M0sZ/SOcQCY0JFefYO+FzoOeulh56RygZeO+Ia6gZUmfNiyUwQprWHreWB6p8Mnhs9qrwUb2+rMdvUwgOiZ2XNaQ+m/niULHj+4ESAggtcDwdnSteXhTy5xPEV0PRyBFLRJZFCV79/wrpANVBJYhm89H+bWyvay4/2Vc92ccGP1fZPy8f/LB//pkMI/E/eysxRfpk/3HOF6KVdHIrdp/cR8S6YTdd6WSMH2D3GHd3MT7tiwMVdaI/vwmwbLozVvCNt1P6dGEzcyqzsuX4W8FvRq1zLUNzxTw83HabYfA4O9zqkbbugU9Vvf+sT1Oz8n0erEuTDrfVVwX/dsC+z1gshDIr5mOcCJFVA0xtjaa8PglFILnvUB1uHl7p3I5hpr6le0Z4Rq0wqkTXse4xmes8ImUx+c30DNnB8Oj8+SACv/Ck1ezyPWYkx0eZw8Tqsm5Yvv831j+FUJDXvJT3e34mbGIB4cqdzYeVODXBjYgk+qSqyvS14wNVhCiULZLioRFMX3Kowu4pvCf1v5dT9xn9HeCcNM8oz7Phc8zWUycCCy3e4PKnB/1NGjMJZ/VVSyPlKa56jwQ/xCzfrRZHd3hEAWKywdDop/2UYrBUVR3mHR4YsCDxo86/QfLQbq09841Z6/WJmhKQ4KnWhDQPT/LNvrRQG+Kh9k8gp7h+ArK+Zk6/sl9xUHmwdoS9RTGI9tlynWPgLC4kipOuXffuBc/6TPO7iwzcuWyHOCduJ3f/f/9NvgRDXdXsaALJK8Lr6sJXpNjR5EqWsMhhsrKO5UIPcS9o/7UIjXI68D6lA9Oq9WKFf1buSuCSQxbgekGNc6VHurqvaXqf+tk2uPVeXuiAV3vn6GmP8LDh7FALY9FcbylRKwfQ05p78R793qaeV6cw2XH4DqTzFnZTPMiat+Vm5+1vA99uD3Qtg45m56G7T91Q4NAZd3cIcJGqDTAn6iwKiTqLJoN5cbfv62ITFjSEG9Tib9HtfTFtbTGJoercF3/PSaXqpdrMyY3njQcyNa58XQov6ltg3v3yC1PzM2VqPQ2E+fIgcOnC3n4HBVnmBCCIOW2Xs/20Za0YjI0wEI9HuDSYBnnbFV65eWMle+XyZZ0tm4xwMJt4l+jphmQtK+i83a5kAyXULDaYVd7RfukcE7+0uJCfzn6tau8GU4KpXhUxfj+3k/nFZSZ+BjvKT+VdpJVY/9NUaVT1XURW1VEdIiRosqWRUrfoTEcoTzOalIKSFIqW8pKi4Wjcoz9N1XxSNsk/4H6pL6QVFoYHmxUlTQK1Q4ZvqtlrmzQrPWvFxwwdqptaxscVqQ5Jt3mZfVMzHNSCJkVJsNnGydUcj/ztGLLbePGXxl3z6+I+OzZW+wM0AwBIiLIZjIDy0wyUQGg0nju3RWOrt4+dURJuVoSaw0p/hpVo3ebQkrCfpWE+FObwkhmx9npbzaFz5wVtvIxYabS7e7Q0dhcR0KBz1rueM2cCEIDYDYl8RThhvujetJLM9EacKMSJfG8N+5PpjnRyN+A58kLXPU9I8KsF/J8QoyqrpO3sf4Th4vxIJbkuP5gGq6D/1J8g2Fv1c0GLkkZYYFB++lwvKstThdR7tWtydt4QonKtTzsN1G4awq3wS8TRfWkI2qTpgecqXswP4pgdwo0Mg03P/Vqbypac9EqW0inyeKTjic0LFqw9+0Vlu8tRHzEzPae6tYY5GNYCQRh0Pa5HfoKwuTjxWGfnscTLREKTDgSsexsdnSvOFp41ZNYlS8S5wuyzQEAzWcxTQv/SZgzNuPLB7T7uwhknCo2KgqPy8iMBlc7hTRTBHR2QCUVKPWhLpVPhxWdGlyJUPru38fMu5N07ZBd5sAxwEeXPL1crCgkpIkVbNBGKc0ikCPIcXDLEpPSv/OMd8xCtgWumbe6u+T8XXG1tK5Y0lLrNemxM9KnV6LxSOLHO/8M3ItRoo7/MXjqVV3V6Eo6gq1NpKmdpqrSJrlqVtmqWtvLKdSAE4jppnYCzqGFrZq5GTj6UIDRptLSQ9d9YpVvlWONkPz8ntx5+AOEC3tuxJj6RDTvnx0929CTcxwfyu8xsZmSZ7Ufbg7aPWP/YPvR9f2IB32doHHHRV77R2KhusLGxqBuNRn4CnoTDWhqWbIuzs27kuLY9aY+PgJnW71brP9bmANYhJxG1bh5wDolODziBaAafcw8JqBiRRAXsfUoRhfVNWVDeyFaNfdw6JAIAAJDj8ANt3MGMQbS0vNJy12ZEbA2jOSGkBYp8Ixg1iIzius1UASLC+IXGkaq0VCbVL8SJtGdu8ROpZnXm044iESCxTGU9+LiZiCB2yQXEu4peLTJ2yR1Epvfykj0TtQRpBQAAFIB/aMZaw0gB2M/bh/hb/zXoWxp9oYmqzaceIhxaFgQfAgAAZAU8VTNWcEaadPMHcgixZ91pSkk3FkTqRNKHHZepMWgFkgSDH+tDeIOPeIREjbuhA8H+c0pLYHZBfHceNfQbjvg/LKMeXJ7b7uPuIMG3o48C8CfGoq1CQA4GiWx0MoG7Mql/PRkOQDDqJqfIqbW+iWdegutknfEuiDATTEqFWYJyk9B3iU6e1WLa4/DK+q94kxNpUrp0w0ODwW/ANGAAAAEtAMC/rOzHAA/lUsqkFl2Cey+FHvfBAqdYQAAO8HlUF3cBDYjAV8AAHAgTCEAKdMsmAiaoAgiAUHgAgBi0aQIEaGBAgAEFHBIQQAOjPKrLLQENbMErAQNo4F+BANIgsjsiEOv284siGE7OL46CcGSZ+Rf3J6ZeQIvG/EVthFHu6iXLjv+BjHoJh/ZKN7Pookp1362bhqWIm1XuGOyUzebPs7cZ5/kUpK6+KILh5PjF3TwF4ThrS7/3fmLqBZSS/6tpM0T94jtXJxcK/gdlqkkKktxe6cZ0LTqHqD6uOt8fNSxvpjgz3rhjeNNPcglj/nRGs4q09FR9aR2QFKjdZO3FBxcgQYEGAxY8wL9R+tUBBwQBhBCNJ9PZfLFc5fWNza3tnd29/YPDo+OT07Pzi8ur65vbu/uHx6fnl9e3d4PiNJEdiZtBUqhjAU4dEh49me/hgbaN8NwVCY+hGfXDvOx8kbSrQGWISsjTVlv7iL2UFhSRtzDT4U7ALfd9haXz/o3kZfRUyHE7TNIX4t3rhv92oU083DveSbf6jSGDbZ7PMUJAL/I42JvMUPf/M+X+JasHHgwEweVg0o1AxkL8wIl4nCT0imybFocgOYc0JLIC/qP1lJB3RbiEwolRZMgdeNL2HoX0ug9SRPdiGfUYZF6UUrZ90l5xiwvuGHrqmz5vea5DQ9CQDxVbkxE+A9dYrCJI7n708sClA+8mMDxACNLZxpCwJ9Fll4UVbmR1tQI=) format("woff2"),url(/blog/assets/fonts/iconfont.938fa69e.woff) format("woff"),url(/blog/assets/fonts/iconfont.ecabaf00.ttf) format("truetype")}.iconfont{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.reco-reddit:before{content:"\e701"}.reco-instagram:before{content:"\e6fc"}.reco-language:before{content:"\e65e"}.reco-bitbucket:before{content:"\eb57"}.reco-faq:before{content:"\e643"}.reco-lock:before{content:"\e60f"}.reco-sticky:before{content:"\e62b"}.reco-blog:before{content:"\e61d"}.reco-mail:before{content:"\e624"}.reco-friend:before{content:"\e62f"}.reco-rss:before{content:"\f09d"}.reco-fullscreen:before{content:"\e602"}.reco-api:before{content:"\e662"}.reco-jianshu:before{content:"\e60c"}.reco-mayun:before{content:"\e6d0"}.reco-weibo:before{content:"\e612"}.reco-bilibili:before{content:"\e630"}.reco-douyin:before{content:"\e654"}.reco-v2ex:before{content:"\e62a"}.reco-csdn:before{content:"\e609"}.reco-juejin:before{content:"\e613"}.reco-wechat:before{content:"\e720"}.reco-qq:before{content:"\e67b"}.reco-facebook:before{content:"\e606"}.reco-twitter:before{content:"\e60b"}.reco-zhihu:before{content:"\e605"}.reco-douban:before{content:"\e603"}.reco-taobao:before{content:"\e6a5"}.reco-toutiao:before{content:"\e6b7"}.reco-linkedin:before{content:"\e668"}.reco-document:before{content:"\e67a"}.reco-sf:before{content:"\e610"}.reco-coding:before{content:"\e601"}.reco-gitlab:before{content:"\e63c"}.reco-suggestion:before{content:"\e608"}.reco-tongzhi:before{content:"\e764"}.reco-huawei:before{content:"\e6b9"}.reco-beian:before{content:"\e667"}.reco-color:before{content:"\eae9"}.reco-other:before{content:"\e60e"}.reco-copyright:before{content:"\ef87"}.reco-theme:before{content:"\e7e8"}.reco-eye:before{content:"\e669"}.reco-menu:before{content:"\e67c"}.reco-up:before{content:"\e68b"}.reco-npm:before{content:"\e88d"}.reco-search:before{content:"\e611"}.reco-message:before{content:"\e634"}.reco-three:before{content:"\e644"}.reco-github:before{content:"\e628"}.reco-bokeyuan:before{content:"\e626"}.reco-date:before{content:"\e63b"}.reco-account:before{content:"\e607"}.reco-category:before{content:"\e61e"}.reco-home:before{content:"\e65b"}.reco-tag:before{content:"\e633"}code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}.categories-wrapper[data-v-ef66d4da]{max-width:860px;margin:0 auto;padding:4.6rem 2.5rem 0}.categories-wrapper .category-wrapper[data-v-ef66d4da]{list-style:none;padding-left:0}.categories-wrapper .category-wrapper .category-item[data-v-ef66d4da]{vertical-align:middle;margin:4px 8px 10px;display:inline-block;cursor:pointer;border-radius:.25rem;font-size:13px;box-shadow:var(--box-shadow);transition:all .5s;background-color:var(--background-color)}.categories-wrapper .category-wrapper .category-item.active[data-v-ef66d4da],.categories-wrapper .category-wrapper .category-item[data-v-ef66d4da]:hover{background:#3eaf7c}.categories-wrapper .category-wrapper .category-item.active a span.category-name[data-v-ef66d4da],.categories-wrapper .category-wrapper .category-item:hover a span.category-name[data-v-ef66d4da]{color:#fff}.categories-wrapper .category-wrapper .category-item.active a span.category-name .post-num[data-v-ef66d4da],.categories-wrapper .category-wrapper .category-item:hover a span.category-name .post-num[data-v-ef66d4da]{color:#3eaf7c}.categories-wrapper .category-wrapper .category-item a[data-v-ef66d4da]{display:flex;box-sizing:border-box;width:100%;height:100%;padding:8px 14px;justify-content:space-between;align-items:center;color:#666}.categories-wrapper .category-wrapper .category-item a .post-num[data-v-ef66d4da]{margin-left:4px;width:1.2rem;height:1.2rem;text-align:center;line-height:1.2rem;border-radius:.25rem;font-size:.7rem;color:#fff}@media (max-width:719px){.categories-wrapper[data-v-ef66d4da]{padding:4.6rem 1rem 0}.page-edit .edit-link[data-v-ef66d4da]{margin-bottom:.5rem}.page-edit .last-updated[data-v-ef66d4da]{font-size:.8em;float:none;text-align:left}}.content__default code{color:#505050;padding:.25rem .5rem;margin:0;font-size:.85em;background-color:var(--code-color);border-radius:3px}.content__default code .token.deleted{color:#ec5975}.content__default code .token.inserted{color:#3eaf7c}.content__default pre,.content__default pre[class*=language-]{line-height:1.4;padding:1.25rem 1.5rem;margin:.85rem 0;background-color:#282c34;border-radius:6px;overflow:auto}.content__default pre[class*=language-] code,.content__default pre code{color:#fff;padding:0;background-color:transparent;border-radius:0}div[class*=language-]{position:relative;background-color:#282c34;border-radius:6px}div[class*=language-] .highlight-lines{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding-top:1.3rem;position:absolute;top:0;left:0;width:100%;line-height:1.4}div[class*=language-] .highlight-lines .highlighted{background-color:rgba(0,0,0,.66)}div[class*=language-] pre,div[class*=language-] pre[class*=language-]{background:transparent;position:relative;z-index:1}div[class*=language-]:before{position:absolute;z-index:3;top:.8em;right:1em;font-size:.75rem;color:hsla(0,0%,100%,.4)}div[class*=language-]:not(.line-numbers-mode) .line-numbers-wrapper{display:none}div[class*=language-].line-numbers-mode .highlight-lines .highlighted{position:relative}div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{content:" ";position:absolute;z-index:3;left:0;top:0;display:block;width:2.5rem;height:100%;background-color:rgba(0,0,0,.66)}div[class*=language-].line-numbers-mode pre{padding-left:3.5rem;vertical-align:middle}div[class*=language-].line-numbers-mode .line-numbers-wrapper{position:absolute;top:0;width:2.5rem;text-align:center;color:hsla(0,0%,100%,.3);padding:1.25rem 0;line-height:1.4}div[class*=language-].line-numbers-mode .line-numbers-wrapper br{-webkit-user-select:none;-moz-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-numbers-wrapper .line-number{position:relative;z-index:4;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:.85em}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;z-index:2;top:0;left:0;width:2.5rem;height:100%;border-radius:6px 0 0 6px;border-right:1px solid rgba(0,0,0,.66);background-color:#282c34}div[class~=language-js]:before{content:"js"}div[class~=language-ts]:before{content:"ts"}div[class~=language-html]:before{content:"html"}div[class~=language-md]:before{content:"md"}div[class~=language-vue]:before{content:"vue"}div[class~=language-css]:before{content:"css"}div[class~=language-sass]:before{content:"sass"}div[class~=language-scss]:before{content:"scss"}div[class~=language-less]:before{content:"less"}div[class~=language-stylus]:before{content:"stylus"}div[class~=language-go]:before{content:"go"}div[class~=language-java]:before{content:"java"}div[class~=language-c]:before{content:"c"}div[class~=language-sh]:before{content:"sh"}div[class~=language-yaml]:before{content:"yaml"}div[class~=language-py]:before{content:"py"}div[class~=language-docker]:before{content:"docker"}div[class~=language-dockerfile]:before{content:"dockerfile"}div[class~=language-makefile]:before{content:"makefile"}div[class~=language-javascript]:before{content:"js"}div[class~=language-typescript]:before{content:"ts"}div[class~=language-markup]:before{content:"html"}div[class~=language-markdown]:before{content:"md"}div[class~=language-json]:before{content:"json"}div[class~=language-ruby]:before{content:"rb"}div[class~=language-python]:before{content:"py"}div[class~=language-bash]:before{content:"sh"}div[class~=language-php]:before{content:"php"}.custom-block .title{font-weight:600;margin-bottom:-.4rem}.custom-block.danger,.custom-block.tip,.custom-block.warning{padding:.1rem 1.5rem;border-left-width:.5rem;border-left-style:solid;margin:1rem 0}.custom-block.tip{background-color:var(--code-color);border-color:#67cc86}.custom-block.tip .title{color:#67cc86}.custom-block.warning{background-color:var(--code-color);border-color:#fb9b5f}.custom-block.warning .title{color:#fb9b5f}.custom-block.danger{background-color:var(--code-color);border-color:#f26d6d}.custom-block.danger .title{color:#f26d6d}.custom-block.right{color:rgba(0,0,0,.4);font-size:.9rem;text-align:right}.custom-block.theorem{margin:1rem 0;padding:.1rem 1.5rem;border-radius:.4rem;background-color:var(--code-color)}.custom-block.theorem .title{font-weight:700}.custom-block.details{display:block;position:relative;border-radius:2px;margin:1em 0;padding:1rem;background-color:var(--code-color)}.custom-block.details h4{margin-top:0}.custom-block.details figure:last-child,.custom-block.details p:last-child{margin-bottom:0;padding-bottom:0}.custom-block.details summary{outline:none;cursor:pointer}.arrow{display:inline-block;width:0;height:0}.arrow.up{border-bottom:6px solid var(--text-color-sub)}.arrow.down,.arrow.up{border-left:4px solid transparent;border-right:4px solid transparent}.arrow.down{border-top:6px solid var(--text-color-sub)}.arrow.right{border-left:6px solid var(--text-color-sub)}.arrow.left,.arrow.right{border-top:4px solid transparent;border-bottom:4px solid transparent}.arrow.left{border-right:6px solid var(--text-color-sub)}.content__default:not(.custom){max-width:860px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.content__default:not(.custom){padding:2rem}}@media (max-width:419px){.content__default:not(.custom){padding:1.5rem}}.table-of-contents .badge{vertical-align:middle}body,html{padding:0;margin:0}body{font-family:Ubuntu,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:15px;color:var(--text-color);background-color:var(--background-color)}.page,.password-wrapper-in{overflow-x:hidden;margin-left:18rem}.navbar{z-index:20;right:0;height:3.6rem;box-sizing:border-box}.navbar,.sidebar-mask{position:fixed;top:0;left:0}.sidebar-mask{z-index:9;width:100vw;height:100vh;display:none;background-color:rgba(0,0,0,.65)}.sidebar{font-size:16px;background-color:var(--background-color);width:18rem;position:fixed;z-index:10;margin:0;top:3.6rem;left:0;bottom:0;box-sizing:border-box;border-right:1px solid var(--border-color);overflow-y:auto}.content__default:not(.custom) a:hover{text-decoration:underline}.content__default:not(.custom) p.demo{padding:1rem 1.5rem;border:1px solid #ddd;border-radius:4px}.content__default:not(.custom) img{max-width:100%}.content__default:not(.custom) :first-child{margin-top:0}.content__default.custom{padding:0;margin:0}.abstract img,.content__default.custom img{max-width:100%}a{font-weight:500;text-decoration:none}a,p a code{color:#3eaf7c}p a code{font-weight:400}kbd{background:#eee;border:.15rem solid #ddd;border-bottom:.25rem solid #ddd;border-radius:.15rem;padding:0 .15em}blockquote{font-size:.9rem;color:#999;border-left:.25rem solid #999;background-color:var(--code-color);margin:.5rem 0;padding:.25rem 0 .25rem 1rem}blockquote>p{margin:0}ol,ul{padding-left:1.2em}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:500;line-height:1.25}.content__default:not(.custom)>h1,.content__default:not(.custom)>h2,.content__default:not(.custom)>h3,.content__default:not(.custom)>h4,.content__default:not(.custom)>h5,.content__default:not(.custom)>h6{margin-top:-1.5rem;padding-top:3.6rem;margin-bottom:1rem}.content__default:not(.custom)>h1:first-child,.content__default:not(.custom)>h2:first-child,.content__default:not(.custom)>h3:first-child,.content__default:not(.custom)>h4:first-child,.content__default:not(.custom)>h5:first-child,.content__default:not(.custom)>h6:first-child{margin-top:-3.5rem}h1{font-size:1.6rem}h2{font-size:1.4rem}h3{font-size:1.2rem}a.header-anchor{font-size:.85em;float:left;margin-left:-.87em;padding-right:.23em;margin-top:.125em;opacity:0}a.header-anchor:hover{text-decoration:none}.line-number,code,kbd{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}ol,p,ul{line-height:2.2}hr{border:0;border-top:1px solid var(--border-color)}table{border-collapse:collapse;margin:1rem 0;display:block;overflow-x:auto}tr{border-top:1px solid var(--border-color)}tr:nth-child(2n){background-color:var(--code-color)}td,th{border:1px solid var(--border-color);padding:.6em 1em}.theme-container.sidebar-open .sidebar-mask{display:block}.theme-container.no-navbar .content__default:not(.custom)>h1,.theme-container.no-navbar h2,.theme-container.no-navbar h3,.theme-container.no-navbar h4,.theme-container.no-navbar h5,.theme-container.no-navbar h6{margin-top:1.5rem;padding-top:0}.theme-container.no-navbar .sidebar{top:0}@media (min-width:720px){.theme-container.no-sidebar .sidebar{display:none}.theme-container.no-sidebar .page,.theme-container.no-sidebar .password-wrapper-in{margin-left:0}}@media (max-width:959px){.sidebar{font-size:15px;width:14.76rem}.page,.password-wrapper-in{margin-left:14.76rem}}@media (max-width:719px){.sidebar{top:0;padding-top:3.6rem;transform:translateX(-100%);transition:transform .2s ease}.page,.password-wrapper-in{margin-left:0}.theme-container.sidebar-open .sidebar{transform:translateX(0)}.theme-container.no-navbar .sidebar{padding-top:0}.password-shadow{padding-left:0}}@media (max-width:419px){h1{font-size:1.9rem}.content__default div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}.iconfont{font-family:iconfont,Ubuntu,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif!important;font-size:13px;color:var(--text-color-sub)}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-thumb:vertical{height:5px;background-color:#3eaf7c}::-webkit-scrollbar-thumb:horizontal{width:5px;background-color:#3eaf7c}.vuepress-flowchart{overflow:auto}.sw-update-popup{border-radius:.25rem!important;box-shadow:var(--box-shadow)!important;color:var(--text-color)!important;background:var(--background-color)!important;border:none!important}.sw-update-popup>button{background:#3eaf7c;border-radius:.25rem;color:#fff;-webkit-tap-highlight-color:rgba(0,0,0,0);border:none}.tag-wrapper[data-v-c29f409a]{max-width:860px;margin:0 auto;padding:4.6rem 2.5rem 0}@media (max-width:719px){.tag-wrapper[data-v-c29f409a]{padding:4.6rem 1rem 0}}.tags-wrapper[data-v-76b3aa19]{max-width:860px;margin:0 auto;padding:4.6rem 2.5rem 0}@media (max-width:719px){.tags-wrapper[data-v-76b3aa19]{padding:5rem .6rem 0}}.timeline-wrapper[data-v-5920e741]{max-width:860px;margin:0 auto;padding:4.6rem 2.5rem 0}.timeline-wrapper .timeline-content[data-v-5920e741]{box-sizing:border-box;position:relative;list-style:none}.timeline-wrapper .timeline-content[data-v-5920e741]:after{content:" ";position:absolute;top:14px;left:0;z-index:-1;margin-left:-2px;width:4px;height:100%;background:var(--border-color)}.timeline-wrapper .timeline-content .desc[data-v-5920e741],.timeline-wrapper .timeline-content .year[data-v-5920e741]{position:relative;color:var(--text-color);font-size:16px}.timeline-wrapper .timeline-content .desc[data-v-5920e741]:before,.timeline-wrapper .timeline-content .year[data-v-5920e741]:before{content:" ";position:absolute;z-index:2;left:-20px;top:50%;margin-left:-4px;margin-top:-4px;width:8px;height:8px;background:var(--background-color);border:1px solid var(--border-color);border-radius:50%}.timeline-wrapper .timeline-content .year[data-v-5920e741]{margin:80px 0 0;color:var(--text-color);font-weight:700;font-size:26px}.timeline-wrapper .timeline-content .year-wrapper[data-v-5920e741]{padding-left:0!important}.timeline-wrapper .timeline-content .year-wrapper li[data-v-5920e741]{display:flex;padding:30px 0 10px;list-style:none;border-bottom:1px dashed var(--border-color);position:relative}.timeline-wrapper .timeline-content .year-wrapper li:hover .date[data-v-5920e741]{color:#3eaf7c}.timeline-wrapper .timeline-content .year-wrapper li:hover .date[data-v-5920e741]:before{background:#3eaf7c}.timeline-wrapper .timeline-content .year-wrapper li:hover .title[data-v-5920e741]{color:#3eaf7c}.timeline-wrapper .timeline-content .year-wrapper li .date[data-v-5920e741]{width:40px;line-height:30px;color:var(--text-color-sub);font-size:12px}.timeline-wrapper .timeline-content .year-wrapper li .date[data-v-5920e741]:before{content:" ";position:absolute;left:-18px;top:41px;width:6px;height:6px;margin-left:-4px;background:var(--background-color);border-radius:50%;border:1px solid var(--border-color);z-index:2}.timeline-wrapper .timeline-content .year-wrapper li .title[data-v-5920e741]{line-height:30px;color:var(--text-color-sub);font-size:16px;cursor:pointer}@media (max-width:719px){.timeline-wrapper[data-v-5920e741]{margin:0 1.2rem}}.content{margin:4rem auto 0;max-width:800px;padding:0 2rem}.mod_404 .desc .desc_link{display:inline-block;background:#424242!important;color:#fff;padding:6px 20px!important;text-decoration:none!important;border-radius:4px}@media screen and (max-width:720px){.mod_404 .desc{margin:50px 0}.mod_404 .wrapper{margin:0!important;padding-top:20px}} \ No newline at end of file diff --git a/assets/fonts/iconfont.938fa69e.woff b/assets/fonts/iconfont.938fa69e.woff new file mode 100644 index 0000000..d2e44dc Binary files /dev/null and b/assets/fonts/iconfont.938fa69e.woff differ diff --git a/assets/fonts/iconfont.ecabaf00.ttf b/assets/fonts/iconfont.ecabaf00.ttf new file mode 100644 index 0000000..eb85b12 Binary files /dev/null and b/assets/fonts/iconfont.ecabaf00.ttf differ diff --git a/assets/img/1.0e6521d0.png b/assets/img/1.0e6521d0.png new file mode 100644 index 0000000..36c3115 Binary files /dev/null and b/assets/img/1.0e6521d0.png differ diff --git a/assets/img/1.5b9dd891.png b/assets/img/1.5b9dd891.png new file mode 100644 index 0000000..17f63c7 Binary files /dev/null and b/assets/img/1.5b9dd891.png differ diff --git a/assets/img/1.81c4c495.jpeg b/assets/img/1.81c4c495.jpeg new file mode 100644 index 0000000..85fac8b Binary files /dev/null and b/assets/img/1.81c4c495.jpeg differ diff --git a/assets/img/1.fd92b8cd.jpeg b/assets/img/1.fd92b8cd.jpeg new file mode 100644 index 0000000..2a18943 Binary files /dev/null and b/assets/img/1.fd92b8cd.jpeg differ diff --git a/assets/img/2.488a3579.jpeg b/assets/img/2.488a3579.jpeg new file mode 100644 index 0000000..0e794d5 Binary files /dev/null and b/assets/img/2.488a3579.jpeg differ diff --git a/assets/img/2.d7f5a561.png b/assets/img/2.d7f5a561.png new file mode 100644 index 0000000..4ab02f6 Binary files /dev/null and b/assets/img/2.d7f5a561.png differ diff --git a/assets/img/2.ef3d5dcb.png b/assets/img/2.ef3d5dcb.png new file mode 100644 index 0000000..96b731d Binary files /dev/null and b/assets/img/2.ef3d5dcb.png differ diff --git a/assets/img/3.0b39ab89.png b/assets/img/3.0b39ab89.png new file mode 100644 index 0000000..8eb01e2 Binary files /dev/null and b/assets/img/3.0b39ab89.png differ diff --git a/assets/img/5.602dfae7.png b/assets/img/5.602dfae7.png new file mode 100644 index 0000000..ac226ef Binary files /dev/null and b/assets/img/5.602dfae7.png differ diff --git a/assets/img/Channel.f9adc640.png b/assets/img/Channel.f9adc640.png new file mode 100644 index 0000000..25ae1a7 Binary files /dev/null and b/assets/img/Channel.f9adc640.png differ diff --git a/assets/img/UrlSchemes.8d865eed.png b/assets/img/UrlSchemes.8d865eed.png new file mode 100644 index 0000000..be8314a Binary files /dev/null and b/assets/img/UrlSchemes.8d865eed.png differ diff --git a/assets/img/api-login.2fcc9f35.jpg b/assets/img/api-login.2fcc9f35.jpg new file mode 100644 index 0000000..f180ebf Binary files /dev/null and b/assets/img/api-login.2fcc9f35.jpg differ diff --git a/assets/img/bg.2cfdbb33.svg b/assets/img/bg.2cfdbb33.svg new file mode 100644 index 0000000..f576b34 --- /dev/null +++ b/assets/img/bg.2cfdbb33.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/build.dfacbc6c.png b/assets/img/build.dfacbc6c.png new file mode 100644 index 0000000..748eeef Binary files /dev/null and b/assets/img/build.dfacbc6c.png differ diff --git a/assets/img/keystore.a6e16c85.png b/assets/img/keystore.a6e16c85.png new file mode 100644 index 0000000..a6f311e Binary files /dev/null and b/assets/img/keystore.a6e16c85.png differ diff --git a/assets/img/package-error-01.4dfc3791.png b/assets/img/package-error-01.4dfc3791.png new file mode 100644 index 0000000..2814eae Binary files /dev/null and b/assets/img/package-error-01.4dfc3791.png differ diff --git a/assets/img/package.12251589.png b/assets/img/package.12251589.png new file mode 100644 index 0000000..af65a21 Binary files /dev/null and b/assets/img/package.12251589.png differ diff --git a/assets/img/umeng.f2cd3e1e.png b/assets/img/umeng.f2cd3e1e.png new file mode 100644 index 0000000..b0bb4dc Binary files /dev/null and b/assets/img/umeng.f2cd3e1e.png differ diff --git a/assets/js/1.7f0b4a0b.js b/assets/js/1.7f0b4a0b.js new file mode 100644 index 0000000..ada565c --- /dev/null +++ b/assets/js/1.7f0b4a0b.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[1,15,18,19,28,30,31,35,36],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return s}));n(134);var o=n(0);function r(){const e=Object(o.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function s(){const e=Object(o.h)(!1);return Object(o.e)(()=>{e.value=!0}),Object(o.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},345:function(e,t,n){"use strict";n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return g}));var o=n(347),r=n.n(o),s=(n(346),n(0)),a=n(1),i=function(e,t,n,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(a=(s<3?r(a):s>3?r(t,n,a):r(t,n))||a);return s>3&&a&&Object.defineProperty(t,n,a),a};const c=/^(\w+)\-/,l=s.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends l{getClass(e){return c.test(e)?e.replace(c,(...e)=>"reco"===e[1]?"iconfont "+e[0]:`${e[1]} ${e[0]}`):e}go(e){""!==e&&window.open(e)}render(){return(0,arguments[0])("i",r()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=i([a.b],u);var d=u,f=function(e,t,n,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(a=(s<3?r(a):s>3?r(t,n,a):r(t,n))||a);return s>3&&a&&Object.defineProperty(t,n,a),a};const p=s.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends p{setStyle(e){e.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,e.style.transform=this.transform[0],e.style.opacity=0}unsetStyle(e){e.style.transform=this.transform[1],e.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=f([a.b],h);var g=h},346:function(e,t,n){"use strict";var o=n(22),r=n(3),s=n(348);o({global:!0},{Reflect:{}}),s(r.Reflect,"Reflect",!0)},347:function(e,t,n){"use strict";function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t,n=1;nObject(r.d)(s.value.link)),c=Object(o.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(e=>e===i.value):"/"===i.value);return{link:i,exact:c,isExternal:r.f,isMailto:r.g,isTel:r.h}}}),c=n(2),l=Object(c.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return e.isExternal(e.link)?t("a",{staticClass:"nav-link external",attrs:{href:e.link,target:e.isMailto(e.link)||e.isTel(e.link)?null:"_blank",rel:e.isMailto(e.link)||e.isTel(e.link)?null:"noopener noreferrer"}},[t("reco-icon",{attrs:{icon:""+e.item.icon}}),e._v("\n "+e._s(e.item.text)+"\n "),t("OutboundLink")],1):t("router-link",{staticClass:"nav-link",attrs:{to:e.link,exact:e.exact}},[t("reco-icon",{attrs:{icon:""+e.item.icon}}),e._v("\n "+e._s(e.item.text)+"\n")],1)}),[],!1,null,null,null);t.default=l.exports},357:function(e,t,n){"use strict";n.r(t);var o=n(0),r=Object(o.c)({name:"DropdownTransition",setup:(e,t)=>({setHeight:e=>{e.style.height=e.scrollHeight+"px"},unsetHeight:e=>{e.style.height=""}})}),s=(n(358),n(2)),a=Object(s.a)(r,(function(){var e=this._self._c;this._self._setupProxy;return e("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);t.default=a.exports},358:function(e,t,n){"use strict";n(350)},359:function(e,t,n){},367:function(e,t,n){},368:function(e,t,n){},373:function(e,t,n){"use strict";n(359)},380:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var o={light:{"--default-color-10":"rgba(255, 255, 255, 1)","--default-color-9":"rgba(255, 255, 255, .9)","--default-color-8":"rgba(255, 255, 255, .8)","--default-color-7":"rgba(255, 255, 255, .7)","--default-color-6":"rgba(255, 255, 255, .6)","--default-color-5":"rgba(255, 255, 255, .5)","--default-color-4":"rgba(255, 255, 255, .4)","--default-color-3":"rgba(255, 255, 255, .3)","--default-color-2":"rgba(255, 255, 255, .2)","--default-color-1":"rgba(255, 255, 255, .1)","--background-color":"#fff","--box-shadow":"0 1px 8px 0 rgba(0, 0, 0, 0.1)","--box-shadow-hover":"0 2px 16px 0 rgba(0, 0, 0, 0.2)","--text-color":"#242424","--text-color-sub":"#7F7F7F","--border-color":"#eaecef","--code-color":"rgba(27, 31, 35, 0.05)","--mask-color":"#888"},dark:{"--default-color-10":"rgba(0, 0, 0, 1)","--default-color-9":"rgba(0, 0, 0, .9)","--default-color-8":"rgba(0, 0, 0, .8)","--default-color-7":"rgba(0, 0, 0, .7)","--default-color-6":"rgba(0, 0, 0, .6)","--default-color-5":"rgba(0, 0, 0, .5)","--default-color-4":"rgba(0, 0, 0, .4)","--default-color-3":"rgba(0, 0, 0, .3)","--default-color-2":"rgba(0, 0, 0, .2)","--default-color-1":"rgba(0, 0, 0, .1)","--background-color":"#181818","--box-shadow":"0 1px 8px 0 rgba(0, 0, 0, .6)","--box-shadow-hover":"0 2px 16px 0 rgba(0, 0, 0, .7)","--text-color":"rgba(255, 255, 255, .8)","--text-color-sub":"#8B8B8B","--border-color":"rgba(0, 0, 0, .3)","--code-color":"rgba(0, 0, 0, .3)","--mask-color":"#000"}};function r(e){const t=document.querySelector(":root"),n=o[e],r="dark"===e?"light":"dark";for(const e in n)t.style.setProperty(e,n[e]);t.classList.remove(r),t.classList.add(e)}function s(e){if("auto"!==e)return void r(e);const t=window.matchMedia("(prefers-color-scheme: dark)").matches,n=window.matchMedia("(prefers-color-scheme: light)").matches;if(t&&r("dark"),n&&r("light"),!t&&!n){console.log("You specified no preference for a color scheme or your browser does not support it. I schedule dark mode during night time.");const e=(new Date).getHours();r(e<6||e>=18?"dark":"light")}}},381:function(e,t,n){"use strict";n.r(t);var o=n(0),r=n(345),s=n(356),a=n(357),i=Object(o.c)({components:{NavLink:s.default,DropdownTransition:a.default,RecoIcon:r.b},props:{item:{required:!0}},setup(e,t){const n=Object(o.h)(!1);return{open:n,toggle:()=>{n.value=!n.value}}}}),c=(n(373),n(2)),l=Object(c.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"dropdown-wrapper",class:{open:e.open}},[t("a",{staticClass:"dropdown-title",on:{click:e.toggle}},[t("span",{staticClass:"title"},[t("reco-icon",{attrs:{icon:""+e.item.icon}}),e._v("\n "+e._s(e.item.text)+"\n ")],1),e._v(" "),t("span",{staticClass:"arrow",class:e.open?"down":"right"})]),e._v(" "),t("DropdownTransition",[t("ul",{directives:[{name:"show",rawName:"v-show",value:e.open,expression:"open"}],staticClass:"nav-dropdown"},e._l(e.item.items,(function(n,o){return t("li",{key:n.link||o,staticClass:"dropdown-item"},["links"===n.type?t("h4",[e._v(e._s(n.text))]):e._e(),e._v(" "),"links"===n.type?t("ul",{staticClass:"dropdown-subitem-wrapper"},e._l(n.items,(function(e){return t("li",{key:e.link,staticClass:"dropdown-subitem"},[t("NavLink",{attrs:{item:e}})],1)})),0):t("NavLink",{attrs:{item:n}})],1)})),0)])],1)}),[],!1,null,null,null);t.default=l.exports},384:function(e,t,n){},385:function(e,t,n){},386:function(e,t,n){"use strict";n(367)},387:function(e,t,n){"use strict";n(368)},388:function(e,t,n){},400:function(e,t,n){"use strict";n.r(t);var o=n(0),r=n(345),s=n(381),a=n(17),i=n(356),c=n(344),l=Object(o.c)({components:{NavLink:i.default,DropdownLink:s.default,RecoIcon:r.b},setup(e,t){const n=Object(c.a)(),r=Object(o.a)(()=>n.$themeLocaleConfig.nav||n.$themeConfig.nav||[]),s=Object(o.a)(()=>{const e=n.$site.locales||{};if(e&&Object.keys(e).length>1){const t=n.$page.path,o=n.$router.options.routes,s=n.$themeConfig.locales||{},a={text:n.$themeLocaleConfig.selectText||"Languages",items:Object.keys(e).map(r=>{const a=e[r],i=s[r]&&s[r].label||a.lang;let c;return a.lang===n.$lang?c=t:(c=t.replace(n.$localeConfig.path,r),o.some(e=>e.path===c)||(c=r)),{text:i,link:c}})};return[...r.value,a]}const t=n.$themeConfig.blogConfig||{},o=r.value.some(e=>!t.category||e.text===(t.category.text||"分类")),s=r.value.some(e=>!t.tag||e.text===(t.tag.text||"标签"));if(!o&&Object.hasOwnProperty.call(t,"category")){const e=t.category,o=n.$categories;r.value.splice(parseInt(e.location||2)-1,0,{items:o.list.map(e=>(e.link=e.path,e.text=e.name,e)),text:e.text||n.$recoLocales.category,type:"links",icon:"reco-category"})}if(!s&&Object.hasOwnProperty.call(t,"tag")){const e=t.tag;r.value.splice(parseInt(e.location||3)-1,0,{link:"/tag/",text:e.text||n.$recoLocales.tag,type:"links",icon:"reco-tag"})}return r.value}),i=Object(o.a)(()=>(n.nav||[]).map(e=>Object.assign(Object(a.j)(e),{items:(e.items||[]).map(a.j)}))),l=Object(o.a)(()=>{const{repo:e}=n.$themeConfig;return e?/^https?:/.test(e)?e:"https://github.com/"+e:""}),u=Object(o.a)(()=>{if(!n.repoLink)return"";if(n.$themeConfig.repoLabel)return n.$themeConfig.repoLabel;const e=n.repoLink.match(/^https?:\/\/[^/]+/)[0],t=["GitHub","GitLab","Bitbucket"];for(let n=0;n({modeOptions:[{mode:"dark",title:"dark"},{mode:"auto",title:"auto"},{mode:"light",title:"light"}],currentMode:"auto"}),mounted(){this.currentMode=localStorage.getItem("mode")||this.$themeConfig.mode||"auto";var e=this;window.matchMedia("(prefers-color-scheme: dark)").addListener(()=>{"auto"===e.$data.currentMode&&Object(o.a)(e.$data.currentMode)}),window.matchMedia("(prefers-color-scheme: light)").addListener(()=>{"auto"===e.$data.currentMode&&Object(o.a)(e.$data.currentMode)}),Object(o.a)(this.currentMode)},methods:{selectMode(e){e!==this.currentMode&&(this.currentMode=e,Object(o.a)(e),localStorage.setItem("mode",e))},getClass(e){return e!==this.currentMode?e:e+" active"}}},s=(n(387),n(2)),a=Object(s.a)(r,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mode-options"},[t("h4",{staticClass:"title"},[e._v("Choose mode")]),e._v(" "),t("ul",{staticClass:"color-mode-options"},e._l(e.modeOptions,(function(n,o){return t("li",{key:o,class:e.getClass(n.mode),on:{click:function(t){return e.selectMode(n.mode)}}},[e._v(e._s(n.title))])})),0)])}),[],!1,null,null,null);t.default=a.exports},404:function(e,t,n){"use strict";n(384)},405:function(e,t,n){"use strict";n(385)},406:function(e,t){function n(e){return"function"==typeof e.value||(console.warn("[Vue-click-outside:] provided expression",e.expression,"is not a function."),!1)}function o(e){return void 0!==e.componentInstance&&e.componentInstance.$isServer}e.exports={bind:function(e,t,r){if(!n(t))return;function s(t){if(r.context){var n=t.path||t.composedPath&&t.composedPath();n&&n.length>0&&n.unshift(t.target),e.contains(t.target)||function(e,t){if(!e||!t)return!1;for(var n=0,o=t.length;nr.focused&&c.value&&c.value.length),i=e=>{for(const t in n.$site.locales||{})if("/"!==t&&0===e.path.indexOf(t))return t;return"/"},c=Object(o.a)(()=>{const e=r.query.trim().toLowerCase();if(!e)return;const{pages:t}=n.$site,o=n.$site.themeConfig.searchMaxSuggestions,s=n.$localePath,a=t=>t&&t.title&&t.title.toLowerCase().indexOf(e)>-1,c=[];for(let e=0;e=o);e++){const n=t[e];if(i(n)===s)if(a(n))c.push(n);else if(n.headers)for(let e=0;e=o);e++){const t=n.headers[e];a(t)&&c.push(Object.assign({},n,{path:n.path+"#"+t.slug,header:t}))}}return c}),l=Object(o.a)(()=>(n.$site.themeConfig.nav||[]).length+(n.$site.repo?1:0)<=2);return{showSuggestions:a,suggestions:c,alignRight:l,onUp:()=>{a.value&&(r.focusIndex>0?r.focusIndex--:r.focusIndex=c.value.length-1)},onDown:()=>{a.value&&(r.focusIndex{r.focusIndex=e},unfocus:()=>{r.focusIndex=-1},go:e=>{a.value&&(n.$router.push(c.value[e].path),r.query="",r.focusIndex=0)},...Object(o.i)(r)}},mounted(){this.placeholder=this.$site.themeConfig.searchPlaceholder||""}}),i=(n(404),n(2)),c=Object(i.a)(a,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"search-box"},[t("reco-icon",{attrs:{icon:"reco-search"}}),e._v(" "),t("input",{ref:"input",class:{focused:e.focused},attrs:{"aria-label":"Search",placeholder:e.placeholder,autocomplete:"off",spellcheck:"false"},domProps:{value:e.query},on:{input:function(t){e.query=t.target.value},focus:function(t){e.focused=!0},blur:function(t){e.focused=!1},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.go(e.focusIndex)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:e.onUp.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:e.onDown.apply(null,arguments)}]}}),e._v(" "),e.showSuggestions?t("ul",{staticClass:"suggestions",class:{"align-right":e.alignRight},on:{mouseleave:e.unfocus}},e._l(e.suggestions,(function(n,o){return t("li",{key:o,staticClass:"suggestion",class:{focused:o===e.focusIndex},on:{mousedown:function(t){return e.go(o)},mouseenter:function(t){return e.focus(o)}}},[t("a",{attrs:{href:n.path},on:{click:function(e){e.preventDefault()}}},[t("span",{staticClass:"page-title"},[e._v(e._s(n.title||n.path))]),e._v(" "),n.header?t("span",{staticClass:"header"},[e._v("> "+e._s(n.header.title))]):e._e()])])})),0):e._e()],1)}),[],!1,null,null,null);t.default=c.exports},430:function(e,t,n){"use strict";n.r(t);var o=n(345),r=n(406),s=n.n(r),a=n(402),i=n(380),c={name:"UserSettings",directives:{"click-outside":s.a},components:{ModePicker:a.default,RecoIcon:o.b,ModuleTransition:o.a},data:()=>({showMenu:!1}),mounted(){const e=this.$themeConfig.mode||"auto",{modePicker:t}=this.$themeConfig;!1===t&&("auto"===e&&(window.matchMedia("(prefers-color-scheme: dark)").addListener(()=>{Object(i.a)(e)}),window.matchMedia("(prefers-color-scheme: light)").addListener(()=>{Object(i.a)(e)})),Object(i.a)(e))},methods:{hideMenu(){this.showMenu=!1}}},l=(n(407),n(2)),u=Object(l.a)(c,(function(){var e=this,t=e._self._c;return!1!==e.$themeConfig.modePicker?t("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"color-picker"},[t("a",{staticClass:"color-button",on:{click:function(t){t.preventDefault(),e.showMenu=!e.showMenu}}},[t("reco-icon",{attrs:{icon:"reco-color"}})],1),e._v(" "),t("ModuleTransition",{attrs:{transform:["translate(-50%, 0)","translate(-50%, -10px)"]}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.showMenu,expression:"showMenu"}],staticClass:"color-picker-menu"},[t("ModePicker")],1)])],1):e._e()}),[],!1,null,null,null);t.default=u.exports},437:function(e,t,n){"use strict";n.r(t);n(405);var o=n(2),r=Object(o.a)({},(function(){var e=this,t=e._self._c;return t("div",{staticClass:"sidebar-button",on:{click:function(t){return e.$emit("toggle-sidebar")}}},[t("svg",{staticClass:"icon",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",viewBox:"0 0 448 512"}},[t("path",{attrs:{fill:"currentColor",d:"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"}})])])}),[],!1,null,null,null);t.default=r.exports},444:function(e,t,n){"use strict";n(418)},475:function(e,t,n){"use strict";n.r(t);var o=n(0),r=n(429),s=n(437),a=n(400),i=n(430),c=n(344),l=Object(o.c)({components:{SidebarButton:s.default,NavLinks:a.default,SearchBox:r.default,AlgoliaSearchBox:{},Mode:i.default},setup(e,t){const n=Object(c.a)(),r=Object(o.h)(null),s=Object(o.a)(()=>n.$themeLocaleConfig.algolia||n.$themeConfig.algolia||{}),a=Object(o.a)(()=>s.value&&s.value.apiKey&&s.value.indexName);function i(e,t){return e.ownerDocument.defaultView.getComputedStyle(e,null)[t]}return Object(o.e)(()=>{const e=parseInt(i(n.$el,"paddingLeft"))+parseInt(i(n.$el,"paddingRight")),t=()=>{document.documentElement.clientWidth<719?r.value=null:r.value=n.$el.offsetWidth-e-(n.$refs.siteName&&n.$refs.siteName.offsetWidth||0)};t(),window.addEventListener("resize",t,!1)}),{linksWrapMaxWidth:r,algolia:s,isAlgoliaSearch:a,css:i}}}),u=(n(444),n(2)),d=Object(u.a)(l,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("header",{staticClass:"navbar"},[t("SidebarButton",{on:{"toggle-sidebar":function(t){return e.$emit("toggle-sidebar")}}}),e._v(" "),t("router-link",{staticClass:"home-link",attrs:{to:e.$localePath}},[e.$themeConfig.logo?t("img",{staticClass:"logo",attrs:{src:e.$withBase(e.$themeConfig.logo),alt:e.$siteTitle}}):e._e(),e._v(" "),e.$siteTitle?t("span",{ref:"siteName",staticClass:"site-name"},[e._v(e._s(e.$siteTitle))]):e._e()]),e._v(" "),t("div",{staticClass:"links",style:e.linksWrapMaxWidth?{"max-width":e.linksWrapMaxWidth+"px"}:{}},[t("Mode"),e._v(" "),e.isAlgoliaSearch?t("AlgoliaSearchBox",{attrs:{options:e.algolia}}):!1!==e.$themeConfig.search&&!1!==e.$frontmatter.search?t("SearchBox"):e._e(),e._v(" "),t("NavLinks",{staticClass:"can-hide"})],1)],1)}),[],!1,null,null,null);t.default=d.exports}}]); \ No newline at end of file diff --git a/assets/js/10.7f4de7cc.js b/assets/js/10.7f4de7cc.js new file mode 100644 index 0000000..2596ca7 --- /dev/null +++ b/assets/js/10.7f4de7cc.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{355:function(e,t,n){},366:function(e,t,n){"use strict";n(355)},428:function(e,t,n){},457:function(e,t,n){"use strict";n(428)},486:function(e,t,n){"use strict";n.r(t);n(16);var o=n(0),s=n(399),a=n(345),r=n(344),i=Object(o.c)({name:"TimeLine",components:{Common:s.default,ModuleTransition:a.a},setup(e,t){const n=Object(r.a)();return{recoShowModule:Object(r.b)(),go:e=>{n.$router.push({path:e})},dateFormat:(e,t)=>{e=function(e){const t=new Date(e).toJSON();return new Date(+new Date(t)+288e5).toISOString().replace(/T/g," ").replace(/\.[\d]{3}Z/,"").replace(/-/g,"/")}(e);const n=new Date(e);return`${n.getMonth()+1}-${n.getDate()}`}}}}),c=(n(366),n(457),n(2)),l=Object(c.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("Common",{staticClass:"timeline-wrapper",attrs:{sidebar:!1}},[t("ul",{staticClass:"timeline-content"},[t("ModuleTransition",[t("li",{directives:[{name:"show",rawName:"v-show",value:e.recoShowModule,expression:"recoShowModule"}],staticClass:"desc"},[e._v(e._s(e.$recoLocales.timeLineMsg))])]),e._v(" "),e._l(e.$recoPostsForTimeline,(function(n,o){return t("ModuleTransition",{key:o,attrs:{delay:String(.08*(o+1))}},[t("li",{directives:[{name:"show",rawName:"v-show",value:e.recoShowModule,expression:"recoShowModule"}]},[t("h3",{staticClass:"year"},[e._v(e._s(n.year))]),e._v(" "),t("ul",{staticClass:"year-wrapper"},e._l(n.data,(function(n,o){return t("li",{key:o},[t("span",{staticClass:"date"},[e._v(e._s(e.dateFormat(n.frontmatter.date)))]),e._v(" "),t("span",{staticClass:"title",on:{click:function(t){return e.go(n.path)}}},[e._v(e._s(n.title))])])})),0)])])}))],2)])}),[],!1,null,"5920e741",null);t.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/11.872437f2.js b/assets/js/11.872437f2.js new file mode 100644 index 0000000..83c1134 --- /dev/null +++ b/assets/js/11.872437f2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{420:function(t,e,n){},448:function(t,e,n){"use strict";n(420)},487:function(t,e,n){"use strict";n.r(e);var i=n(0),p=Object(i.c)({functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:(t,{props:e,slots:n})=>t("span",{class:["badge",e.type],style:{verticalAlign:e.vertical}},e.text||n().default)}),c=(n(448),n(2)),l=Object(c.a)(p,void 0,void 0,!1,null,"8f29db2c",null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/14.5459deb5.js b/assets/js/14.5459deb5.js new file mode 100644 index 0000000..c22a371 --- /dev/null +++ b/assets/js/14.5459deb5.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[14,8,15,18,30,35,37],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));n(134);var s=n(0);function i(){const t=Object(s.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function o(){const t=Object(s.h)(!1);return Object(s.e)(()=>{t.value=!0}),Object(s.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return p})),n.d(e,"a",(function(){return b}));var s=n(347),i=n.n(s),o=(n(346),n(0)),r=n(1),a=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};const l=/^(\w+)\-/,c=o.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends c{getClass(t){return l.test(t)?t.replace(l,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",i()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=a([r.b],u);var p=u,f=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};const d=o.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=f([r.b],h);var b=h},346:function(t,e,n){"use strict";var s=n(22),i=n(3),o=n(348);s({global:!0},{Reflect:{}}),o(i.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function s(){return(s=Object.assign?Object.assign.bind():function(t){for(var e,n=1;nObject(i.d)(o.value.link)),l=Object(s.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(t=>t===a.value):"/"===a.value);return{link:a,exact:l,isExternal:i.f,isMailto:i.g,isTel:i.h}}}),l=n(2),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.isExternal(t.link)?e("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.isMailto(t.link)||t.isTel(t.link)?null:"_blank",rel:t.isMailto(t.link)||t.isTel(t.link)?null:"noopener noreferrer"}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n "),e("OutboundLink")],1):e("router-link",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n")],1)}),[],!1,null,null,null);e.default=c.exports},357:function(t,e,n){"use strict";n.r(e);var s=n(0),i=Object(s.c)({name:"DropdownTransition",setup:(t,e)=>({setHeight:t=>{t.style.height=t.scrollHeight+"px"},unsetHeight:t=>{t.style.height=""}})}),o=(n(358),n(2)),r=Object(o.a)(i,(function(){var t=this._self._c;this._self._setupProxy;return t("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.default=r.exports},358:function(t,e,n){"use strict";n(350)},359:function(t,e,n){},360:function(t,e,n){},367:function(t,e,n){},369:function(t,e,n){},373:function(t,e,n){"use strict";n(359)},374:function(t,e,n){"use strict";n(360)},379:function(t,e,n){"use strict";n.r(e);var s=n(0),i=n(401),o=n(383),r=n(17),a=n(344);var l=Object(s.c)({name:"SidebarLinks",components:{SidebarGroup:i.default,SidebarLink:o.default},props:["items","depth","sidebarDepth"],setup(t,e){const n=Object(a.a)(),{items:i}=Object(s.i)(t),o=Object(s.h)(0),l=()=>{const t=function(t,e){for(let n=0;n"page"===e.type&&Object(r.e)(t,e.path)))return n}return-1}(n.$route,i.value);t>-1&&(o.value=t)},c=()=>{const t=[].slice.call(document.querySelectorAll(".header-anchor")).filter(t=>-1!=decodeURIComponent(n.$route.fullPath).indexOf(decodeURIComponent(t.hash)));null==t||t.length<1||null==t[0].offsetTop||setTimeout((function(){window.scrollTo(0,t[0].offsetTop+160)}),100)},u=()=>{const t=document.getElementsByClassName("sidebar")[0];let e=document.getElementsByClassName("active sidebar-link")[1];if(null!=e&&null!=e&&null!=e.offsetTop||(e=document.getElementsByClassName("active sidebar-link")[0]),null==e||null==e||null==e.offsetTop)return;const n=t.clientHeight||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=e.offsetTop,i=e.offsetTop+e.offsetHeight,o=t.scrollTop;i<=n+o||(t.scrollTop=i+5-n);s>=o||(t.scrollTop=s-5)},p=t=>p(n.$route,t.regularPath);return l(),Object(s.e)(()=>{(()=>{const t=decodeURIComponent(n.$route.fullPath);if(!t||""==t)return;const e=[].slice.call(document.querySelectorAll(".sidebar-link"));for(let n=0;nu()),{openGroupIndex:o,refreshIndex:l,toggleGroup:t=>{n.openGroupIndex=t===n.openGroupIndex?-1:t},isActive:p}},watch:{$route(){this.refreshIndex()}}}),c=n(2),u=Object(c.a)(l,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.items.length?e("ul",{staticClass:"sidebar-links"},t._l(t.items,(function(n,s){return e("li",{key:s},["group"===n.type?e("SidebarGroup",{attrs:{item:n,open:s===t.openGroupIndex,collapsable:n.collapsable||n.collapsible,depth:t.depth},on:{toggle:function(e){return t.toggleGroup(s)}}}):e("SidebarLink",{attrs:{sidebarDepth:t.sidebarDepth,item:n}})],1)})),0):t._e()}),[],!1,null,null,null);e.default=u.exports},381:function(t,e,n){"use strict";n.r(e);var s=n(0),i=n(345),o=n(356),r=n(357),a=Object(s.c)({components:{NavLink:o.default,DropdownTransition:r.default,RecoIcon:i.b},props:{item:{required:!0}},setup(t,e){const n=Object(s.h)(!1);return{open:n,toggle:()=>{n.value=!n.value}}}}),l=(n(373),n(2)),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"dropdown-wrapper",class:{open:t.open}},[e("a",{staticClass:"dropdown-title",on:{click:t.toggle}},[e("span",{staticClass:"title"},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n ")],1),t._v(" "),e("span",{staticClass:"arrow",class:t.open?"down":"right"})]),t._v(" "),e("DropdownTransition",[e("ul",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],staticClass:"nav-dropdown"},t._l(t.item.items,(function(n,s){return e("li",{key:n.link||s,staticClass:"dropdown-item"},["links"===n.type?e("h4",[t._v(t._s(n.text))]):t._e(),t._v(" "),"links"===n.type?e("ul",{staticClass:"dropdown-subitem-wrapper"},t._l(n.items,(function(t){return e("li",{key:t.link,staticClass:"dropdown-subitem"},[e("NavLink",{attrs:{item:t}})],1)})),0):e("NavLink",{attrs:{item:n}})],1)})),0)])],1)}),[],!1,null,null,null);e.default=c.exports},383:function(t,e,n){"use strict";n.r(e);var s=n(0),i=n(17);var o=Object(s.c)({functional:!0,props:["item","sidebarDepth"],render(t,{parent:{$page:e,$site:n,$route:s,$themeConfig:o,$themeLocaleConfig:r},props:{item:a,sidebarDepth:l}}){const c=Object(i.e)(s,a.path),u="auto"===a.type?c||a.children.some(t=>Object(i.e)(s,a.basePath+"#"+t.slug)):c;return function(t,e,n,s){return t("router-link",{props:{to:e,activeClass:"",exactActiveClass:""},class:{active:s,"sidebar-link":!0}},n)}(t,a.path,a.title||a.path,u)}}),r=(n(374),n(2)),a=Object(r.a)(o,void 0,void 0,!1,null,null,null);e.default=a.exports},386:function(t,e,n){"use strict";n(367)},389:function(t,e,n){"use strict";n(369)},390:function(t,e,n){},400:function(t,e,n){"use strict";n.r(e);var s=n(0),i=n(345),o=n(381),r=n(17),a=n(356),l=n(344),c=Object(s.c)({components:{NavLink:a.default,DropdownLink:o.default,RecoIcon:i.b},setup(t,e){const n=Object(l.a)(),i=Object(s.a)(()=>n.$themeLocaleConfig.nav||n.$themeConfig.nav||[]),o=Object(s.a)(()=>{const t=n.$site.locales||{};if(t&&Object.keys(t).length>1){const e=n.$page.path,s=n.$router.options.routes,o=n.$themeConfig.locales||{},r={text:n.$themeLocaleConfig.selectText||"Languages",items:Object.keys(t).map(i=>{const r=t[i],a=o[i]&&o[i].label||r.lang;let l;return r.lang===n.$lang?l=e:(l=e.replace(n.$localeConfig.path,i),s.some(t=>t.path===l)||(l=i)),{text:a,link:l}})};return[...i.value,r]}const e=n.$themeConfig.blogConfig||{},s=i.value.some(t=>!e.category||t.text===(e.category.text||"分类")),o=i.value.some(t=>!e.tag||t.text===(e.tag.text||"标签"));if(!s&&Object.hasOwnProperty.call(e,"category")){const t=e.category,s=n.$categories;i.value.splice(parseInt(t.location||2)-1,0,{items:s.list.map(t=>(t.link=t.path,t.text=t.name,t)),text:t.text||n.$recoLocales.category,type:"links",icon:"reco-category"})}if(!o&&Object.hasOwnProperty.call(e,"tag")){const t=e.tag;i.value.splice(parseInt(t.location||3)-1,0,{link:"/tag/",text:t.text||n.$recoLocales.tag,type:"links",icon:"reco-tag"})}return i.value}),a=Object(s.a)(()=>(n.nav||[]).map(t=>Object.assign(Object(r.j)(t),{items:(t.items||[]).map(r.j)}))),c=Object(s.a)(()=>{const{repo:t}=n.$themeConfig;return t?/^https?:/.test(t)?t:"https://github.com/"+t:""}),u=Object(s.a)(()=>{if(!n.repoLink)return"";if(n.$themeConfig.repoLabel)return n.$themeConfig.repoLabel;const t=n.repoLink.match(/^https?:\/\/[^/]+/)[0],e=["GitHub","GitLab","Bitbucket"];for(let n=0;n(Object(r.a)().$options.components.SidebarLinks=n(379).default,{isActive:i.e})}),l=(n(389),n(2)),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("section",{staticClass:"sidebar-group",class:[{collapsable:t.collapsable,"is-sub-group":0!==t.depth},"depth-"+t.depth]},[t.item.path?e("router-link",{staticClass:"sidebar-heading clickable",class:{open:t.open,active:t.isActive(t.$route,t.item.path)},attrs:{to:t.item.path},nativeOn:{click:function(e){return t.$emit("toggle")}}},[e("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?e("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]):e("p",{staticClass:"sidebar-heading",class:{open:t.open},on:{click:function(e){return t.$emit("toggle")}}},[e("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?e("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]),t._v(" "),e("DropdownTransition",[t.open||!t.collapsable?e("SidebarLinks",{staticClass:"sidebar-group-items",attrs:{items:t.item.children,sidebarDepth:t.item.sidebarDepth,depth:t.depth+1}}):t._e()],1)],1)}),[],!1,null,null,null);e.default=c.exports},408:function(t,e,n){"use strict";n(390)},431:function(t,e,n){"use strict";n.r(e);var s=n(0),i=n(379),o=n(400),r=Object(s.c)({name:"Sidebar",components:{SidebarLinks:i.default,NavLinks:o.default},props:["items"]}),a=(n(408),n(2)),l=Object(a.a)(r,(function(){var t=this._self._c;this._self._setupProxy;return t("aside",{staticClass:"sidebar"},[this._t("top"),this._v(" "),t("NavLinks"),this._v(" "),t("SidebarLinks",{attrs:{depth:0,items:this.items}}),this._v(" "),this._t("bottom")],2)}),[],!1,null,null,null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/15.95e9f60f.js b/assets/js/15.95e9f60f.js new file mode 100644 index 0000000..0715663 --- /dev/null +++ b/assets/js/15.95e9f60f.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[15,18,30,35],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return i}));n(134);var r=n(0);function s(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function i(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return v}));var r=n(347),s=n.n(r),i=(n(346),n(0)),o=n(1),a=function(t,e,n,r){var s,i=arguments.length,o=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};const l=/^(\w+)\-/,c=i.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends c{getClass(t){return l.test(t)?t.replace(l,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",s()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=a([o.b],u);var f=u,p=function(t,e,n,r){var s,i=arguments.length,o=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};const d=i.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=p([o.b],h);var v=h},346:function(t,e,n){"use strict";var r=n(22),s=n(3),i=n(348);r({global:!0},{Reflect:{}}),i(s.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;nObject(s.d)(i.value.link)),l=Object(r.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(t=>t===a.value):"/"===a.value);return{link:a,exact:l,isExternal:s.f,isMailto:s.g,isTel:s.h}}}),l=n(2),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.isExternal(t.link)?e("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.isMailto(t.link)||t.isTel(t.link)?null:"_blank",rel:t.isMailto(t.link)||t.isTel(t.link)?null:"noopener noreferrer"}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n "),e("OutboundLink")],1):e("router-link",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n")],1)}),[],!1,null,null,null);e.default=c.exports},357:function(t,e,n){"use strict";n.r(e);var r=n(0),s=Object(r.c)({name:"DropdownTransition",setup:(t,e)=>({setHeight:t=>{t.style.height=t.scrollHeight+"px"},unsetHeight:t=>{t.style.height=""}})}),i=(n(358),n(2)),o=Object(i.a)(s,(function(){var t=this._self._c;this._self._setupProxy;return t("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.default=o.exports},358:function(t,e,n){"use strict";n(350)},359:function(t,e,n){},367:function(t,e,n){},373:function(t,e,n){"use strict";n(359)},381:function(t,e,n){"use strict";n.r(e);var r=n(0),s=n(345),i=n(356),o=n(357),a=Object(r.c)({components:{NavLink:i.default,DropdownTransition:o.default,RecoIcon:s.b},props:{item:{required:!0}},setup(t,e){const n=Object(r.h)(!1);return{open:n,toggle:()=>{n.value=!n.value}}}}),l=(n(373),n(2)),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"dropdown-wrapper",class:{open:t.open}},[e("a",{staticClass:"dropdown-title",on:{click:t.toggle}},[e("span",{staticClass:"title"},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n ")],1),t._v(" "),e("span",{staticClass:"arrow",class:t.open?"down":"right"})]),t._v(" "),e("DropdownTransition",[e("ul",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],staticClass:"nav-dropdown"},t._l(t.item.items,(function(n,r){return e("li",{key:n.link||r,staticClass:"dropdown-item"},["links"===n.type?e("h4",[t._v(t._s(n.text))]):t._e(),t._v(" "),"links"===n.type?e("ul",{staticClass:"dropdown-subitem-wrapper"},t._l(n.items,(function(t){return e("li",{key:t.link,staticClass:"dropdown-subitem"},[e("NavLink",{attrs:{item:t}})],1)})),0):e("NavLink",{attrs:{item:n}})],1)})),0)])],1)}),[],!1,null,null,null);e.default=c.exports},386:function(t,e,n){"use strict";n(367)},400:function(t,e,n){"use strict";n.r(e);var r=n(0),s=n(345),i=n(381),o=n(17),a=n(356),l=n(344),c=Object(r.c)({components:{NavLink:a.default,DropdownLink:i.default,RecoIcon:s.b},setup(t,e){const n=Object(l.a)(),s=Object(r.a)(()=>n.$themeLocaleConfig.nav||n.$themeConfig.nav||[]),i=Object(r.a)(()=>{const t=n.$site.locales||{};if(t&&Object.keys(t).length>1){const e=n.$page.path,r=n.$router.options.routes,i=n.$themeConfig.locales||{},o={text:n.$themeLocaleConfig.selectText||"Languages",items:Object.keys(t).map(s=>{const o=t[s],a=i[s]&&i[s].label||o.lang;let l;return o.lang===n.$lang?l=e:(l=e.replace(n.$localeConfig.path,s),r.some(t=>t.path===l)||(l=s)),{text:a,link:l}})};return[...s.value,o]}const e=n.$themeConfig.blogConfig||{},r=s.value.some(t=>!e.category||t.text===(e.category.text||"分类")),i=s.value.some(t=>!e.tag||t.text===(e.tag.text||"标签"));if(!r&&Object.hasOwnProperty.call(e,"category")){const t=e.category,r=n.$categories;s.value.splice(parseInt(t.location||2)-1,0,{items:r.list.map(t=>(t.link=t.path,t.text=t.name,t)),text:t.text||n.$recoLocales.category,type:"links",icon:"reco-category"})}if(!i&&Object.hasOwnProperty.call(e,"tag")){const t=e.tag;s.value.splice(parseInt(t.location||3)-1,0,{link:"/tag/",text:t.text||n.$recoLocales.tag,type:"links",icon:"reco-tag"})}return s.value}),a=Object(r.a)(()=>(n.nav||[]).map(t=>Object.assign(Object(o.j)(t),{items:(t.items||[]).map(o.j)}))),c=Object(r.a)(()=>{const{repo:t}=n.$themeConfig;return t?/^https?:/.test(t)?t:"https://github.com/"+t:""}),u=Object(r.a)(()=>{if(!n.repoLink)return"";if(n.$themeConfig.repoLabel)return n.$themeConfig.repoLabel;const t=n.repoLink.match(/^https?:\/\/[^/]+/)[0],e=["GitHub","GitLab","Bitbucket"];for(let n=0;n{t.value=!0}),Object(n.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,r){"use strict";r.d(e,"b",(function(){return f})),r.d(e,"a",(function(){return h}));var n=r(347),a=r.n(n),o=(r(346),r(0)),s=r(1),c=function(t,e,r,n){var a,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(s=(o<3?a(s):o>3?a(e,r,s):a(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s};const i=/^(\w+)\-/,u=o.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let l=class extends u{getClass(t){return i.test(t)?t.replace(i,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",a()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};l=c([s.b],l);var f=l,p=function(t,e,r,n){var a,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(s=(o<3?a(s):o>3?a(e,r,s):a(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s};const g=o.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let d=class extends g{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};d=p([s.b],d);var h=d},346:function(t,e,r){"use strict";var n=r(22),a=r(3),o=r(348);n({global:!0},{Reflect:{}}),o(a.Reflect,"Reflect",!0)},347:function(t,e,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(t){for(var e,r=1;r({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const r=Object(o.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{r.$route.path!==`/tag/${t}/`&&r.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(r.$lang).format(new Date(t))}}}),c=(r(352),r(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(r,n){return e("span",{key:n,staticClass:"tag-item",class:{active:t.currentTag==r},on:{click:function(e){return e.stopPropagation(),t.goTags(r)}}},[t._v(t._s(r))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},354:function(t,e,r){},362:function(t,e,r){"use strict";r(351)},364:function(t,e,r){"use strict";r.r(e);r(16);var n=r(0),a=r(345),o=r(353),s=Object(n.c)({components:{PageInfo:o.default,RecoIcon:a.b},props:["item","currentPage","currentTag"]}),c=(r(362),r(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports},365:function(t,e,r){"use strict";r(354)},372:function(t,e,r){"use strict";r.r(e);var n=r(0),a={methods:{_getStoragePage(){const t=window.location.pathname,e=JSON.parse(sessionStorage.getItem("currentPage"));return null===e||t!==e.path?(sessionStorage.setItem("currentPage",JSON.stringify({page:1,path:""})),1):parseInt(e.page)},_setStoragePage(t){const e=window.location.pathname;sessionStorage.setItem("currentPage",JSON.stringify({page:t,path:e}))}}},o=r(364),s=r(344),c=Object(n.c)({mixins:[a],components:{NoteAbstractItem:o.default},props:["data","currentTag"],setup(t,e){const r=Object(s.a)(),{data:a}=Object(n.i)(t),o=Object(n.h)(1),c=Object(n.a)(()=>{const t=(o.value-1)*r.$perPage,e=o.value*r.$perPage;return a.value.slice(t,e)});return Object(n.e)(()=>{o.value=r._getStoragePage()||1}),{currentPage:o,currentPageData:c,getCurrentPage:t=>{o.value=t,r._setStoragePage(t),e.emit("paginationChange",t)}}},watch:{$route(){this.currentPage=this._getStoragePage()||1}}}),i=(r(365),r(2)),u=Object(i.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-wrapper"},[t._l(t.currentPageData,(function(r){return e("NoteAbstractItem",{key:r.path,attrs:{item:r,currentPage:t.currentPage,currentTag:t.currentTag}})})),t._v(" "),e("pagation",{staticClass:"pagation",attrs:{total:t.data.length,currentPage:t.currentPage},on:{getCurrentPage:t.getCurrentPage}})],2)}),[],!1,null,"21a20f36",null);e.default=u.exports}}]); \ No newline at end of file diff --git a/assets/js/17.468ab2fb.js b/assets/js/17.468ab2fb.js new file mode 100644 index 0000000..1d96757 --- /dev/null +++ b/assets/js/17.468ab2fb.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return a}));n(134);var r=n(0);function s(){const e=Object(r.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function a(){const e=Object(r.h)(!1);return Object(r.e)(()=>{e.value=!0}),Object(r.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},345:function(e,t,n){"use strict";n.d(t,"b",(function(){return f})),n.d(t,"a",(function(){return y}));var r=n(347),s=n.n(r),a=(n(346),n(0)),i=n(1),o=function(e,t,n,r){var s,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(a<3?s(i):a>3?s(t,n,i):s(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i};const c=/^(\w+)\-/,l=a.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends l{getClass(e){return c.test(e)?e.replace(c,(...e)=>"reco"===e[1]?"iconfont "+e[0]:`${e[1]} ${e[0]}`):e}go(e){""!==e&&window.open(e)}render(){return(0,arguments[0])("i",s()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=o([i.b],u);var f=u,p=function(e,t,n,r){var s,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(a<3?s(i):a>3?s(t,n,i):s(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i};const h=a.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let d=class extends h{setStyle(e){e.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,e.style.transform=this.transform[0],e.style.opacity=0}unsetStyle(e){e.style.transform=this.transform[1],e.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};d=p([i.b],d);var y=d},346:function(e,t,n){"use strict";var r=n(22),s=n(3),a=n(348);r({global:!0},{Reflect:{}}),a(s.Reflect,"Reflect",!0)},347:function(e,t,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t,n=1;n{Promise.all([Promise.all([n.e(0),n.e(13)]).then(n.t.bind(null,477,7)),Promise.all([n.e(0),n.e(13)]).then(n.t.bind(null,478,7))]).then(([n])=>{n=n.default;const{algoliaOptions:r={}}=e;n(Object.assign({},e,{inputSelector:"#algolia-search-input",algoliaOptions:Object.assign({facetFilters:["lang:"+t].concat(r.facetFilters||[])},r),handleSelected:(e,t,n)=>{const{pathname:r,hash:s}=new URL(n.url);this.$router.push(`${r}${s}`)}}))})};return Object(r.e)(()=>{o(e.options,s.$lang),i.value=s.$site.themeConfig.searchPlaceholder||""}),{placeholder:i,initialize:o,update:(e,t)=>{s.$el.innerHTML='',s.initialize(e,t)}}},watch:{$lang(e){this.update(this.options,e)},options(e){this.update(e,this.$lang)}}}),o=(n(443),n(2)),c=Object(o.a)(i,(function(){var e=this._self._c;this._self._setupProxy;return e("form",{staticClass:"algolia-search-wrapper search-box",attrs:{id:"search-form",role:"search"}},[e("reco-icon",{attrs:{icon:"reco-search"}}),this._v(" "),e("input",{staticClass:"search-query",attrs:{id:"algolia-search-input",placeholder:this.placeholder}})],1)}),[],!1,null,null,null);t.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/18.c3951251.js b/assets/js/18.c3951251.js new file mode 100644 index 0000000..36f1a04 --- /dev/null +++ b/assets/js/18.c3951251.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[18,30,35],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i}));n(134);var s=n(0);function r(){const t=Object(s.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function i(){const t=Object(s.h)(!1);return Object(s.e)(()=>{t.value=!0}),Object(s.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return v}));var s=n(347),r=n.n(s),i=(n(346),n(0)),o=n(1),a=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};const l=/^(\w+)\-/,c=i.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends c{getClass(t){return l.test(t)?t.replace(l,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",r()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=a([o.b],u);var f=u,p=function(t,e,n,s){var r,i=arguments.length,o=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i<3?r(o):i>3?r(e,n,o):r(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};const d=i.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=p([o.b],h);var v=h},346:function(t,e,n){"use strict";var s=n(22),r=n(3),i=n(348);s({global:!0},{Reflect:{}}),i(r.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function s(){return(s=Object.assign?Object.assign.bind():function(t){for(var e,n=1;nObject(r.d)(i.value.link)),l=Object(s.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(t=>t===a.value):"/"===a.value);return{link:a,exact:l,isExternal:r.f,isMailto:r.g,isTel:r.h}}}),l=n(2),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.isExternal(t.link)?e("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.isMailto(t.link)||t.isTel(t.link)?null:"_blank",rel:t.isMailto(t.link)||t.isTel(t.link)?null:"noopener noreferrer"}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n "),e("OutboundLink")],1):e("router-link",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n")],1)}),[],!1,null,null,null);e.default=c.exports},357:function(t,e,n){"use strict";n.r(e);var s=n(0),r=Object(s.c)({name:"DropdownTransition",setup:(t,e)=>({setHeight:t=>{t.style.height=t.scrollHeight+"px"},unsetHeight:t=>{t.style.height=""}})}),i=(n(358),n(2)),o=Object(i.a)(r,(function(){var t=this._self._c;this._self._setupProxy;return t("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.default=o.exports},358:function(t,e,n){"use strict";n(350)},359:function(t,e,n){},373:function(t,e,n){"use strict";n(359)},381:function(t,e,n){"use strict";n.r(e);var s=n(0),r=n(345),i=n(356),o=n(357),a=Object(s.c)({components:{NavLink:i.default,DropdownTransition:o.default,RecoIcon:r.b},props:{item:{required:!0}},setup(t,e){const n=Object(s.h)(!1);return{open:n,toggle:()=>{n.value=!n.value}}}}),l=(n(373),n(2)),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"dropdown-wrapper",class:{open:t.open}},[e("a",{staticClass:"dropdown-title",on:{click:t.toggle}},[e("span",{staticClass:"title"},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n ")],1),t._v(" "),e("span",{staticClass:"arrow",class:t.open?"down":"right"})]),t._v(" "),e("DropdownTransition",[e("ul",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],staticClass:"nav-dropdown"},t._l(t.item.items,(function(n,s){return e("li",{key:n.link||s,staticClass:"dropdown-item"},["links"===n.type?e("h4",[t._v(t._s(n.text))]):t._e(),t._v(" "),"links"===n.type?e("ul",{staticClass:"dropdown-subitem-wrapper"},t._l(n.items,(function(t){return e("li",{key:t.link,staticClass:"dropdown-subitem"},[e("NavLink",{attrs:{item:t}})],1)})),0):e("NavLink",{attrs:{item:n}})],1)})),0)])],1)}),[],!1,null,null,null);e.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/19.8e03fa5a.js b/assets/js/19.8e03fa5a.js new file mode 100644 index 0000000..eb060b2 --- /dev/null +++ b/assets/js/19.8e03fa5a.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[19,31],{345:function(e,t,o){"use strict";o.d(t,"b",(function(){return d})),o.d(t,"a",(function(){return m}));var r=o(347),n=o.n(r),a=(o(346),o(0)),c=o(1),s=function(e,t,o,r){var n,a=arguments.length,c=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(a<3?n(c):a>3?n(t,o,c):n(t,o))||c);return a>3&&c&&Object.defineProperty(t,o,c),c};const i=/^(\w+)\-/,l=a.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends l{getClass(e){return i.test(e)?e.replace(i,(...e)=>"reco"===e[1]?"iconfont "+e[0]:`${e[1]} ${e[0]}`):e}go(e){""!==e&&window.open(e)}render(){return(0,arguments[0])("i",n()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=s([c.b],u);var d=u,f=function(e,t,o,r){var n,a=arguments.length,c=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(a<3?n(c):a>3?n(t,o,c):n(t,o))||c);return a>3&&c&&Object.defineProperty(t,o,c),c};const h=a.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let p=class extends h{setStyle(e){e.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,e.style.transform=this.transform[0],e.style.opacity=0}unsetStyle(e){e.style.transform=this.transform[1],e.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};p=f([c.b],p);var m=p},346:function(e,t,o){"use strict";var r=o(22),n=o(3),a=o(348);r({global:!0},{Reflect:{}}),a(n.Reflect,"Reflect",!0)},347:function(e,t,o){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t,o=1;o=18?"dark":"light")}}},387:function(e,t,o){"use strict";o(368)},388:function(e,t,o){},402:function(e,t,o){"use strict";o.r(t);var r=o(380),n={name:"ModeOptions",data:()=>({modeOptions:[{mode:"dark",title:"dark"},{mode:"auto",title:"auto"},{mode:"light",title:"light"}],currentMode:"auto"}),mounted(){this.currentMode=localStorage.getItem("mode")||this.$themeConfig.mode||"auto";var e=this;window.matchMedia("(prefers-color-scheme: dark)").addListener(()=>{"auto"===e.$data.currentMode&&Object(r.a)(e.$data.currentMode)}),window.matchMedia("(prefers-color-scheme: light)").addListener(()=>{"auto"===e.$data.currentMode&&Object(r.a)(e.$data.currentMode)}),Object(r.a)(this.currentMode)},methods:{selectMode(e){e!==this.currentMode&&(this.currentMode=e,Object(r.a)(e),localStorage.setItem("mode",e))},getClass(e){return e!==this.currentMode?e:e+" active"}}},a=(o(387),o(2)),c=Object(a.a)(n,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mode-options"},[t("h4",{staticClass:"title"},[e._v("Choose mode")]),e._v(" "),t("ul",{staticClass:"color-mode-options"},e._l(e.modeOptions,(function(o,r){return t("li",{key:r,class:e.getClass(o.mode),on:{click:function(t){return e.selectMode(o.mode)}}},[e._v(e._s(o.title))])})),0)])}),[],!1,null,null,null);t.default=c.exports},406:function(e,t){function o(e){return"function"==typeof e.value||(console.warn("[Vue-click-outside:] provided expression",e.expression,"is not a function."),!1)}function r(e){return void 0!==e.componentInstance&&e.componentInstance.$isServer}e.exports={bind:function(e,t,n){if(!o(t))return;function a(t){if(n.context){var o=t.path||t.composedPath&&t.composedPath();o&&o.length>0&&o.unshift(t.target),e.contains(t.target)||function(e,t){if(!e||!t)return!1;for(var o=0,r=t.length;o({showMenu:!1}),mounted(){const e=this.$themeConfig.mode||"auto",{modePicker:t}=this.$themeConfig;!1===t&&("auto"===e&&(window.matchMedia("(prefers-color-scheme: dark)").addListener(()=>{Object(s.a)(e)}),window.matchMedia("(prefers-color-scheme: light)").addListener(()=>{Object(s.a)(e)})),Object(s.a)(e))},methods:{hideMenu(){this.showMenu=!1}}},l=(o(407),o(2)),u=Object(l.a)(i,(function(){var e=this,t=e._self._c;return!1!==e.$themeConfig.modePicker?t("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"color-picker"},[t("a",{staticClass:"color-button",on:{click:function(t){t.preventDefault(),e.showMenu=!e.showMenu}}},[t("reco-icon",{attrs:{icon:"reco-color"}})],1),e._v(" "),t("ModuleTransition",{attrs:{transform:["translate(-50%, 0)","translate(-50%, -10px)"]}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.showMenu,expression:"showMenu"}],staticClass:"color-picker-menu"},[t("ModePicker")],1)])],1):e._e()}),[],!1,null,null,null);t.default=u.exports}}]); \ No newline at end of file diff --git a/assets/js/2.455e3a05.js b/assets/js/2.455e3a05.js new file mode 100644 index 0000000..0525622 --- /dev/null +++ b/assets/js/2.455e3a05.js @@ -0,0 +1,8 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[2,37],{360:function(e,t,n){},361:function(e,t){var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n>>24)|4278255360&(n[p]<<24|n[p]>>>8);n[l>>>5]|=128<>>9<<4)]=l;var h=i._ff,g=i._gg,m=i._hh,b=i._ii;for(p=0;p>>0,u=u+y>>>0,d=d+_>>>0,f=f+w>>>0}return s.endian([c,u,d,f])})._ff=function(e,t,n,s,o,a,r){var i=e+(t&n|~t&s)+(o>>>0)+r;return(i<>>32-a)+t},i._gg=function(e,t,n,s,o,a,r){var i=e+(t&s|n&~s)+(o>>>0)+r;return(i<>>32-a)+t},i._hh=function(e,t,n,s,o,a,r){var i=e+(t^n^s)+(o>>>0)+r;return(i<>>32-a)+t},i._ii=function(e,t,n,s,o,a,r){var i=e+(n^(t|~s))+(o>>>0)+r;return(i<>>32-a)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=s.wordsToBytes(i(e,t));return t&&t.asBytes?n:t&&t.asString?r.bytesToString(n):s.bytesToHex(n)}},376:function(e,t){var n,s;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&s.rotl(e,8)|4278255360&s.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,s=0;n>>5]|=e[n]<<24-s%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-a)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],s=0,o=0;s>>6-2*o);return t}},e.exports=s},377:function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},379:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(401),a=n(383),r=n(17),i=n(344);var l=Object(s.c)({name:"SidebarLinks",components:{SidebarGroup:o.default,SidebarLink:a.default},props:["items","depth","sidebarDepth"],setup(e,t){const n=Object(i.a)(),{items:o}=Object(s.i)(e),a=Object(s.h)(0),l=()=>{const e=function(e,t){for(let n=0;n"page"===t.type&&Object(r.e)(e,t.path)))return n}return-1}(n.$route,o.value);e>-1&&(a.value=e)},c=()=>{const e=[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>-1!=decodeURIComponent(n.$route.fullPath).indexOf(decodeURIComponent(e.hash)));null==e||e.length<1||null==e[0].offsetTop||setTimeout((function(){window.scrollTo(0,e[0].offsetTop+160)}),100)},u=()=>{const e=document.getElementsByClassName("sidebar")[0];let t=document.getElementsByClassName("active sidebar-link")[1];if(null!=t&&null!=t&&null!=t.offsetTop||(t=document.getElementsByClassName("active sidebar-link")[0]),null==t||null==t||null==t.offsetTop)return;const n=e.clientHeight||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=t.offsetTop,o=t.offsetTop+t.offsetHeight,a=e.scrollTop;o<=n+a||(e.scrollTop=o+5-n);s>=a||(e.scrollTop=s-5)},d=e=>d(n.$route,e.regularPath);return l(),Object(s.e)(()=>{(()=>{const e=decodeURIComponent(n.$route.fullPath);if(!e||""==e)return;const t=[].slice.call(document.querySelectorAll(".sidebar-link"));for(let n=0;nu()),{openGroupIndex:a,refreshIndex:l,toggleGroup:e=>{n.openGroupIndex=e===n.openGroupIndex?-1:e},isActive:d}},watch:{$route(){this.refreshIndex()}}}),c=n(2),u=Object(c.a)(l,(function(){var e=this,t=e._self._c;e._self._setupProxy;return e.items.length?t("ul",{staticClass:"sidebar-links"},e._l(e.items,(function(n,s){return t("li",{key:s},["group"===n.type?t("SidebarGroup",{attrs:{item:n,open:s===e.openGroupIndex,collapsable:n.collapsable||n.collapsible,depth:e.depth},on:{toggle:function(t){return e.toggleGroup(s)}}}):t("SidebarLink",{attrs:{sidebarDepth:e.sidebarDepth,item:n}})],1)})),0):e._e()}),[],!1,null,null,null);t.default=u.exports},383:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(17);var a=Object(s.c)({functional:!0,props:["item","sidebarDepth"],render(e,{parent:{$page:t,$site:n,$route:s,$themeConfig:a,$themeLocaleConfig:r},props:{item:i,sidebarDepth:l}}){const c=Object(o.e)(s,i.path),u="auto"===i.type?c||i.children.some(e=>Object(o.e)(s,i.basePath+"#"+e.slug)):c;return function(e,t,n,s){return e("router-link",{props:{to:t,activeClass:"",exactActiveClass:""},class:{active:s,"sidebar-link":!0}},n)}(e,i.path,i.title||i.path,u)}}),r=(n(374),n(2)),i=Object(r.a)(a,void 0,void 0,!1,null,null,null);t.default=i.exports},389:function(e,t,n){"use strict";n(369)},390:function(e,t,n){},391:function(e,t,n){"use strict";n(370)},392:function(e,t,n){},393:function(e,t,n){},399:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(475),a=n(431),r=n(403),i=n(432),l=n(438),c=n(445),u=n(344),d=Object(s.c)({components:{Sidebar:a.default,Navbar:o.default,Password:i.default,PersonalInfo:r.default,SubSidebar:l.default},props:{sidebar:{type:Boolean,default:!0},sidebarItems:{type:Array,default:()=>[]},showModule:{type:Boolean,default:!1}},setup(e,t){const n=Object(u.a)(),o=Object(s.h)(!1),a=Object(s.h)(!0),r=Object(s.h)(!0),i=Object(s.h)(!0),l=Object(s.a)(()=>e.sidebarItems.length>0),d=Object(s.a)(()=>n.$themeConfig.keyPage&&!0===n.$themeConfig.keyPage.absoluteEncryption),f=Object(s.a)(()=>{const{themeConfig:e}=n.$site,{frontmatter:t}=n.$page;return!1!==t.navbar&&!1!==e.navbar&&(n.$title||e.logo||e.repo||e.nav||n.$themeLocaleConfig.nav)}),p=Object(s.a)(()=>{const e={"no-navbar":!f.value,"sidebar-open":o.value,"no-sidebar":!l.value},{pageClass:t}=n.$frontmatter||{};return t&&(e[t]=!0),e}),h=()=>{const{keyPage:e}=n.$themeConfig;if(!e||!e.keys||0===e.keys.length)return void(a.value=!0);let{keys:t}=e;t=t.map(e=>e.toLowerCase()),a.value=t&&t.indexOf(sessionStorage.getItem("key"))>-1},g=()=>{let e=n.$frontmatter.keys;e&&0!==e.length?(e=e.map(e=>e.toLowerCase()),r.value=e.indexOf(sessionStorage.getItem("pageKey"+window.location.pathname))>-1):r.value=!0};return Object(s.e)(()=>{n.$router.afterEach(()=>{o.value=!1}),h(),g(),(()=>{const e=n.$frontmatter.home&&null==sessionStorage.getItem("firstLoad")?1e3:0;Object(c.setTimeout)(()=>{i.value=!1,null==sessionStorage.getItem("firstLoad")&&sessionStorage.setItem("firstLoad",!1)},e)})()}),{isSidebarOpen:o,absoluteEncryption:d,shouldShowNavbar:f,shouldShowSidebar:l,pageClasses:p,hasKey:h,hasPageKey:g,isHasKey:a,isHasPageKey:r,toggleSidebar:e=>{o.value="boolean"==typeof e?e:!o.value},firstLoad:i}},watch:{$frontmatter(e,t){this.hasKey(),this.hasPageKey()}}}),f=(n(447),n(2)),p=Object(f.a)(d,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"theme-container",class:e.pageClasses},[e.absoluteEncryption?t("div",[t("transition",{attrs:{name:"fade"}},[e.isHasKey?e._e():t("Password")],1),e._v(" "),e.isHasKey?t("div",[e.shouldShowNavbar?t("Navbar",{on:{"toggle-sidebar":e.toggleSidebar}}):e._e(),e._v(" "),t("div",{staticClass:"sidebar-mask",on:{click:function(t){return e.toggleSidebar(!1)}}}),e._v(" "),t("Sidebar",{attrs:{items:e.sidebarItems},on:{"toggle-sidebar":e.toggleSidebar}},[t("PersonalInfo",{attrs:{slot:"top"},slot:"top"}),e._v(" "),e._t("sidebar-bottom",null,{slot:"bottom"})],2),e._v(" "),e.isHasPageKey?e._t("default"):t("Password",{attrs:{isPage:!0}})],2):e._e()],1):t("div",[t("transition",{attrs:{name:"fade"}},[t("Password",{directives:[{name:"show",rawName:"v-show",value:!e.firstLoad&&!e.isHasKey,expression:"!firstLoad && !isHasKey"}],key:"out",staticClass:"password-wrapper-out"})],1),e._v(" "),t("div",{class:{hide:e.firstLoad||!e.isHasKey}},[e.shouldShowNavbar?t("Navbar",{on:{"toggle-sidebar":e.toggleSidebar}}):e._e(),e._v(" "),t("div",{staticClass:"sidebar-mask",on:{click:function(t){return e.toggleSidebar(!1)}}}),e._v(" "),t("Sidebar",{attrs:{items:e.sidebarItems},on:{"toggle-sidebar":e.toggleSidebar}},[t("PersonalInfo",{attrs:{slot:"top"},slot:"top"}),e._v(" "),e._t("sidebar-bottom",null,{slot:"bottom"})],2),e._v(" "),t("Password",{directives:[{name:"show",rawName:"v-show",value:!e.isHasPageKey,expression:"!isHasPageKey"}],key:"in",staticClass:"password-wrapper-in",attrs:{isPage:!0}}),e._v(" "),t("div",{class:{hide:!e.isHasPageKey}},[e._t("default")],2),e._v(" "),t("SubSidebar",{staticClass:"sub-sidebar"})],1)],1)])}),[],!1,null,"7dd95ae2",null);t.default=p.exports},401:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(17),a=n(357),r=n(344),i=Object(s.c)({name:"SidebarGroup",props:["item","open","collapsable","depth"],components:{DropdownTransition:a.default},setup:(e,t)=>(Object(r.a)().$options.components.SidebarLinks=n(379).default,{isActive:o.e})}),l=(n(389),n(2)),c=Object(l.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("section",{staticClass:"sidebar-group",class:[{collapsable:e.collapsable,"is-sub-group":0!==e.depth},"depth-"+e.depth]},[e.item.path?t("router-link",{staticClass:"sidebar-heading clickable",class:{open:e.open,active:e.isActive(e.$route,e.item.path)},attrs:{to:e.item.path},nativeOn:{click:function(t){return e.$emit("toggle")}}},[t("span",[e._v(e._s(e.item.title))]),e._v(" "),e.collapsable?t("span",{staticClass:"arrow",class:e.open?"down":"right"}):e._e()]):t("p",{staticClass:"sidebar-heading",class:{open:e.open},on:{click:function(t){return e.$emit("toggle")}}},[t("span",[e._v(e._s(e.item.title))]),e._v(" "),e.collapsable?t("span",{staticClass:"arrow",class:e.open?"down":"right"}):e._e()]),e._v(" "),t("DropdownTransition",[e.open||!e.collapsable?t("SidebarLinks",{staticClass:"sidebar-group-items",attrs:{items:e.item.children,sidebarDepth:e.item.sidebarDepth,depth:e.depth+1}}):e._e()],1)],1)}),[],!1,null,null,null);t.default=c.exports},403:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(345),a=n(43),r=n(344),i=Object(s.c)({components:{RecoIcon:o.b},setup(e,t){const n=Object(r.a)();return{socialLinks:Object(s.a)(()=>(n.$themeConfig.blogConfig&&n.$themeConfig.blogConfig.socialLinks||[]).map(e=>(e.color||(e.color=Object(a.b)()),e)))}}}),l=(n(391),n(2)),c=Object(l.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"personal-info-wrapper"},[e.$themeConfig.authorAvatar?t("img",{staticClass:"personal-img",attrs:{src:e.$withBase(e.$themeConfig.authorAvatar),alt:"author-avatar"}}):e._e(),e._v(" "),e.$themeConfig.author?t("h3",{staticClass:"name"},[e._v("\n "+e._s(e.$themeConfig.author)+"\n ")]):e._e(),e._v(" "),t("div",{staticClass:"num"},[t("div",[t("h3",[e._v(e._s(e.$recoPosts.length))]),e._v(" "),t("h6",[e._v(e._s(e.$recoLocales.article))])]),e._v(" "),t("div",[t("h3",[e._v(e._s(e.$tags.list.length))]),e._v(" "),t("h6",[e._v(e._s(e.$recoLocales.tag))])])]),e._v(" "),t("ul",{staticClass:"social-links"},e._l(e.socialLinks,(function(e,n){return t("li",{key:n,staticClass:"social-item"},[t("reco-icon",{style:{color:e.color},attrs:{icon:e.icon,link:e.link}})],1)})),0),e._v(" "),t("hr")])}),[],!1,null,"1fad0c41",null);t.default=c.exports},408:function(e,t,n){"use strict";n(390)},409:function(e,t,n){"use strict";n(392)},410:function(e,t,n){"use strict";n(393)},419:function(e,t,n){},431:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(379),a=n(400),r=Object(s.c)({name:"Sidebar",components:{SidebarLinks:o.default,NavLinks:a.default},props:["items"]}),i=(n(408),n(2)),l=Object(i.a)(r,(function(){var e=this._self._c;this._self._setupProxy;return e("aside",{staticClass:"sidebar"},[this._t("top"),this._v(" "),e("NavLinks"),this._v(" "),e("SidebarLinks",{attrs:{depth:0,items:this.items}}),this._v(" "),this._t("bottom")],2)}),[],!1,null,null,null);t.default=l.exports},432:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(375),a=n.n(o),r=n(345),i=n(344),l=Object(s.c)({name:"Password",components:{RecoIcon:r.b},props:{isPage:{type:Boolean,default:!1}},setup(e,t){const n=Object(i.a)(),o=(new Date).getFullYear(),r=Object(s.h)(""),l=Object(s.h)("Konck! Knock!"),{isPage:c}=Object(s.i)(e);return{warningText:l,year:o,key:r,inter:()=>{const e=a()(r.value.trim()),t="pageKey"+window.location.pathname,s=c.value?t:"key";sessionStorage.setItem(s,e);if(!(c.value?(()=>{const e=n.$frontmatter.keys.map(e=>e.toLowerCase()),t="pageKey"+window.location.pathname;return e&&e.indexOf(sessionStorage.getItem(t))>-1})():(()=>{let{keys:e}=n.$themeConfig.keyPage;return e=e.map(e=>e.toLowerCase()),e.indexOf(sessionStorage.getItem("key"))>-1})()))return void(l.value="Key Error");l.value="Key Success";const o=document.getElementById("box").style.width;n.$refs.passwordBtn.style.width=o-2+"px",n.$refs.passwordBtn.style.opacity=1,setTimeout(()=>{window.location.reload()},800)},inputFocus:()=>{l.value="Input Your Key"},inputBlur:()=>{l.value="Konck! Knock!"}}}}),c=(n(409),n(2)),u=Object(c.a)(l,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"password-shadow"},[t("h3",{staticClass:"title"},[e._v(e._s(e.isPage?e.$frontmatter.title:e.$site.title||e.$localeConfig.title))]),e._v(" "),e.isPage?e._e():t("p",{staticClass:"description"},[e._v(e._s(e.$site.description||e.$localeConfig.description))]),e._v(" "),t("label",{staticClass:"inputBox",attrs:{id:"box"}},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.key,expression:"key"}],attrs:{type:"password"},domProps:{value:e.key},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.inter.apply(null,arguments)},focus:e.inputFocus,blur:e.inputBlur,input:function(t){t.target.composing||(e.key=t.target.value)}}}),e._v(" "),t("span",[e._v(e._s(e.warningText))]),e._v(" "),t("button",{ref:"passwordBtn",on:{click:e.inter}},[e._v("OK")])]),e._v(" "),t("div",{staticClass:"footer"},[t("span",[t("reco-icon",{attrs:{icon:"reco-theme"}}),e._v(" "),t("a",{attrs:{target:"blank",href:"https://vuepress-theme-reco.recoluan.com"}},[e._v("vuePress-theme-reco")])],1),e._v(" "),t("span",[t("reco-icon",{attrs:{icon:"reco-copyright"}}),e._v(" "),t("a",[e.$themeConfig.author?t("span",[e._v(e._s(e.$themeConfig.author))]):e._e(),e._v("\n   \n "),e.$themeConfig.startYear&&e.$themeConfig.startYear!=e.year?t("span",[e._v(e._s(e.$themeConfig.startYear)+" - ")]):e._e(),e._v("\n "+e._s(e.year)+"\n ")])],1)])])}),[],!1,null,"59e6cb88",null);t.default=u.exports},438:function(e,t,n){"use strict";n.r(t);var s=n(0),o=n(17),a=n(344),r=Object(s.c)({setup(e,t){const n=Object(a.a)();return{headers:Object(s.a)(()=>n.$showSubSideBar?n.$page.headers:[]),isLinkActive:e=>Object(o.e)(n.$route,n.$page.path+"#"+e.slug)}},render(e){return e("ul",{class:{"sub-sidebar-wrapper":!0},style:{width:this.headers.length>0?"12rem":"0"}},[...this.headers.map(t=>e("li",{class:{active:this.isLinkActive(t),["level-"+t.level]:!0},attr:{key:t.title}},[e("router-link",{class:{"sidebar-link":!0,["reco-side-"+t.slug]:!0},props:{to:`${this.$page.path}#${t.slug}`}},t.title)]))])}}),i=(n(410),n(2)),l=Object(i.a)(r,void 0,void 0,!1,null,"b57cc07c",null);t.default=l.exports},445:function(e,t,n){var s="undefined"!=typeof global&&global||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(o.call(setTimeout,s,arguments),clearTimeout)},t.setInterval=function(){return new a(o.call(setInterval,s,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(s,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(446),t.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof global&&global.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof global&&global.clearImmediate||this&&this.clearImmediate},446:function(e,t){!function(e,t){"use strict";if(!e.setImmediate){var n,s,o,a,r,i=1,l={},c=!1,u=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?n=function(e){process.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},n=function(e){o.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(s=u.documentElement,n=function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):n=function(e){setTimeout(p,0,e)}:(a="setImmediate$"+Math.random()+"$",r=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;s{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return h}));var r=n(347),o=n.n(r),s=(n(346),n(0)),i=n(1),a=function(t,e,n,r){var o,s=arguments.length,i=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const u=/^(\w+)\-/,c=s.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let f=class extends c{getClass(t){return u.test(t)?t.replace(u,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};f=a([i.b],f);var l=f,p=function(t,e,n,r){var o,s=arguments.length,i=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const y=s.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let d=class extends y{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};d=p([i.b],d);var h=d},346:function(t,e,n){"use strict";var r=n(22),o=n(3),s=n(348);r({global:!0},{Reflect:{}}),s(o.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n>>24)|4278255360&(n[y]<<24|n[y]>>>8);n[u>>>5]|=128<>>9<<4)]=u;var d=a._ff,h=a._gg,g=a._hh,v=a._ii;for(y=0;y>>0,f=f+m>>>0,l=l+w>>>0,p=p+_>>>0}return r.endian([c,f,l,p])})._ff=function(t,e,n,r,o,s,i){var a=t+(e&n|~e&r)+(o>>>0)+i;return(a<>>32-s)+e},a._gg=function(t,e,n,r,o,s,i){var a=t+(e&r|n&~r)+(o>>>0)+i;return(a<>>32-s)+e},a._hh=function(t,e,n,r,o,s,i){var a=t+(e^n^r)+(o>>>0)+i;return(a<>>32-s)+e},a._ii=function(t,e,n,r,o,s,i){var a=t+(n^(e|~r))+(o>>>0)+i;return(a<>>32-s)+e},a._blocksize=16,a._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var n=r.wordsToBytes(a(t,e));return e&&e.asBytes?n:e&&e.asString?i.bytesToString(n):r.bytesToHex(n)}},376:function(t,e){var n,r;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(t,e){return t<>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&r.rotl(t,8)|4278255360&r.rotl(t,24);for(var e=0;e0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],n=0,r=0;n>>5]|=t[n]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],n=0;n<32*t.length;n+=8)e.push(t[n>>>5]>>>24-n%32&255);return e},bytesToHex:function(t){for(var e=[],n=0;n>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],n=0;n>>6*(3-s)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,o=0;r>>6-2*o);return e}},t.exports=r},377:function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},392:function(t,e,n){},409:function(t,e,n){"use strict";n(392)},432:function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(375),s=n.n(o),i=n(345),a=n(344),u=Object(r.c)({name:"Password",components:{RecoIcon:i.b},props:{isPage:{type:Boolean,default:!1}},setup(t,e){const n=Object(a.a)(),o=(new Date).getFullYear(),i=Object(r.h)(""),u=Object(r.h)("Konck! Knock!"),{isPage:c}=Object(r.i)(t);return{warningText:u,year:o,key:i,inter:()=>{const t=s()(i.value.trim()),e="pageKey"+window.location.pathname,r=c.value?e:"key";sessionStorage.setItem(r,t);if(!(c.value?(()=>{const t=n.$frontmatter.keys.map(t=>t.toLowerCase()),e="pageKey"+window.location.pathname;return t&&t.indexOf(sessionStorage.getItem(e))>-1})():(()=>{let{keys:t}=n.$themeConfig.keyPage;return t=t.map(t=>t.toLowerCase()),t.indexOf(sessionStorage.getItem("key"))>-1})()))return void(u.value="Key Error");u.value="Key Success";const o=document.getElementById("box").style.width;n.$refs.passwordBtn.style.width=o-2+"px",n.$refs.passwordBtn.style.opacity=1,setTimeout(()=>{window.location.reload()},800)},inputFocus:()=>{u.value="Input Your Key"},inputBlur:()=>{u.value="Konck! Knock!"}}}}),c=(n(409),n(2)),f=Object(c.a)(u,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"password-shadow"},[e("h3",{staticClass:"title"},[t._v(t._s(t.isPage?t.$frontmatter.title:t.$site.title||t.$localeConfig.title))]),t._v(" "),t.isPage?t._e():e("p",{staticClass:"description"},[t._v(t._s(t.$site.description||t.$localeConfig.description))]),t._v(" "),e("label",{staticClass:"inputBox",attrs:{id:"box"}},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.key,expression:"key"}],attrs:{type:"password"},domProps:{value:t.key},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.inter.apply(null,arguments)},focus:t.inputFocus,blur:t.inputBlur,input:function(e){e.target.composing||(t.key=e.target.value)}}}),t._v(" "),e("span",[t._v(t._s(t.warningText))]),t._v(" "),e("button",{ref:"passwordBtn",on:{click:t.inter}},[t._v("OK")])]),t._v(" "),e("div",{staticClass:"footer"},[e("span",[e("reco-icon",{attrs:{icon:"reco-theme"}}),t._v(" "),e("a",{attrs:{target:"blank",href:"https://vuepress-theme-reco.recoluan.com"}},[t._v("vuePress-theme-reco")])],1),t._v(" "),e("span",[e("reco-icon",{attrs:{icon:"reco-copyright"}}),t._v(" "),e("a",[t.$themeConfig.author?e("span",[t._v(t._s(t.$themeConfig.author))]):t._e(),t._v("\n   \n "),t.$themeConfig.startYear&&t.$themeConfig.startYear!=t.year?e("span",[t._v(t._s(t.$themeConfig.startYear)+" - ")]):t._e(),t._v("\n "+t._s(t.year)+"\n ")])],1)])])}),[],!1,null,"59e6cb88",null);e.default=f.exports}}]); \ No newline at end of file diff --git a/assets/js/21.eb3bcc9c.js b/assets/js/21.eb3bcc9c.js new file mode 100644 index 0000000..9cc2185 --- /dev/null +++ b/assets/js/21.eb3bcc9c.js @@ -0,0 +1,8 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[21,27],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return s}));n(134);var r=n(0);function o(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function s(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return g}));var r=n(347),o=n.n(r),s=(n(346),n(0)),i=n(1),a=function(t,e,n,r){var o,s=arguments.length,i=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const c=/^(\w+)\-/,u=s.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let f=class extends u{getClass(t){return c.test(t)?t.replace(c,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};f=a([i.b],f);var l=f,h=function(t,e,n,r){var o,s=arguments.length,i=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const p=s.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let y=class extends p{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};y=h([i.b],y);var g=y},346:function(t,e,n){"use strict";var r=n(22),o=n(3),s=n(348);r({global:!0},{Reflect:{}}),s(o.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n>>24)|4278255360&(n[p]<<24|n[p]>>>8);n[c>>>5]|=128<>>9<<4)]=c;var y=a._ff,g=a._gg,d=a._hh,v=a._ii;for(p=0;p>>0,f=f+_>>>0,l=l+m>>>0,h=h+O>>>0}return r.endian([u,f,l,h])})._ff=function(t,e,n,r,o,s,i){var a=t+(e&n|~e&r)+(o>>>0)+i;return(a<>>32-s)+e},a._gg=function(t,e,n,r,o,s,i){var a=t+(e&r|n&~r)+(o>>>0)+i;return(a<>>32-s)+e},a._hh=function(t,e,n,r,o,s,i){var a=t+(e^n^r)+(o>>>0)+i;return(a<>>32-s)+e},a._ii=function(t,e,n,r,o,s,i){var a=t+(n^(e|~r))+(o>>>0)+i;return(a<>>32-s)+e},a._blocksize=16,a._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var n=r.wordsToBytes(a(t,e));return e&&e.asBytes?n:e&&e.asString?i.bytesToString(n):r.bytesToHex(n)}},376:function(t,e){var n,r;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(t,e){return t<>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&r.rotl(t,8)|4278255360&r.rotl(t,24);for(var e=0;e0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],n=0,r=0;n>>5]|=t[n]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],n=0;n<32*t.length;n+=8)e.push(t[n>>>5]>>>24-n%32&255);return e},bytesToHex:function(t){for(var e=[],n=0;n>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],n=0;n>>6*(3-s)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,o=0;r>>6-2*o);return e}},t.exports=r},377:function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},391:function(t,e,n){"use strict";n(370)},403:function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(345),s=n(43),i=n(344),a=Object(r.c)({components:{RecoIcon:o.b},setup(t,e){const n=Object(i.a)();return{socialLinks:Object(r.a)(()=>(n.$themeConfig.blogConfig&&n.$themeConfig.blogConfig.socialLinks||[]).map(t=>(t.color||(t.color=Object(s.b)()),t)))}}}),c=(n(391),n(2)),u=Object(c.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"personal-info-wrapper"},[t.$themeConfig.authorAvatar?e("img",{staticClass:"personal-img",attrs:{src:t.$withBase(t.$themeConfig.authorAvatar),alt:"author-avatar"}}):t._e(),t._v(" "),t.$themeConfig.author?e("h3",{staticClass:"name"},[t._v("\n "+t._s(t.$themeConfig.author)+"\n ")]):t._e(),t._v(" "),e("div",{staticClass:"num"},[e("div",[e("h3",[t._v(t._s(t.$recoPosts.length))]),t._v(" "),e("h6",[t._v(t._s(t.$recoLocales.article))])]),t._v(" "),e("div",[e("h3",[t._v(t._s(t.$tags.list.length))]),t._v(" "),e("h6",[t._v(t._s(t.$recoLocales.tag))])])]),t._v(" "),e("ul",{staticClass:"social-links"},t._l(t.socialLinks,(function(t,n){return e("li",{key:n,staticClass:"social-item"},[e("reco-icon",{style:{color:t.color},attrs:{icon:t.icon,link:t.link}})],1)})),0),t._v(" "),e("hr")])}),[],!1,null,"1fad0c41",null);e.default=u.exports}}]); \ No newline at end of file diff --git a/assets/js/22.d52d27df.js b/assets/js/22.d52d27df.js new file mode 100644 index 0000000..959d0e6 --- /dev/null +++ b/assets/js/22.d52d27df.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[22,26],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));n(134);var r=n(0);function o(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function a(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return g}));var r=n(347),o=n.n(r),a=(n(346),n(0)),s=n(1),c=function(t,e,n,r){var o,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(a<3?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};const i=/^(\w+)\-/,u=a.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let f=class extends u{getClass(t){return i.test(t)?t.replace(i,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};f=c([s.b],f);var l=f,p=function(t,e,n,r){var o,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(a<3?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};const d=a.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let y=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};y=p([s.b],y);var g=y},346:function(t,e,n){"use strict";var r=n(22),o=n(3),a=n(348);r({global:!0},{Reflect:{}}),a(o.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const n=Object(a.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{n.$route.path!==`/tag/${t}/`&&n.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(n.$lang).format(new Date(t))}}}),c=(n(352),n(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(n,r){return e("span",{key:r,staticClass:"tag-item",class:{active:t.currentTag==n},on:{click:function(e){return e.stopPropagation(),t.goTags(n)}}},[t._v(t._s(n))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},362:function(t,e,n){"use strict";n(351)},364:function(t,e,n){"use strict";n.r(e);n(16);var r=n(0),o=n(345),a=n(353),s=Object(r.c)({components:{PageInfo:a.default,RecoIcon:o.b},props:["item","currentPage","currentTag"]}),c=(n(362),n(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports}}]); \ No newline at end of file diff --git a/assets/js/23.68857ba0.js b/assets/js/23.68857ba0.js new file mode 100644 index 0000000..7d0ef80 --- /dev/null +++ b/assets/js/23.68857ba0.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[23,26],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return o}));n(134);var a=n(0);function r(){const t=Object(a.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function o(){const t=Object(a.h)(!1);return Object(a.e)(()=>{t.value=!0}),Object(a.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return g}));var a=n(347),r=n.n(a),o=(n(346),n(0)),s=n(1),i=function(t,e,n,a){var r,o=arguments.length,s=o<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,a);else for(var i=t.length-1;i>=0;i--)(r=t[i])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};const c=/^(\w+)\-/,l=o.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends l{getClass(t){return c.test(t)?t.replace(c,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",r()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=i([s.b],u);var f=u,p=function(t,e,n,a){var r,o=arguments.length,s=o<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,a);else for(var i=t.length-1;i>=0;i--)(r=t[i])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};const d=o.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=p([s.b],h);var g=h},346:function(t,e,n){"use strict";var a=n(22),r=n(3),o=n(348);a({global:!0},{Reflect:{}}),o(r.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function a(){return(a=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const n=Object(o.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{n.$route.path!==`/tag/${t}/`&&n.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(n.$lang).format(new Date(t))}}}),i=(n(352),n(2)),c=Object(i.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(n,a){return e("span",{key:a,staticClass:"tag-item",class:{active:t.currentTag==n},on:{click:function(e){return e.stopPropagation(),t.goTags(n)}}},[t._v(t._s(n))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=c.exports},397:function(t,e,n){},415:function(t,e,n){"use strict";n(397)},436:function(t,e,n){"use strict";n.r(e);n(16);var a=n(0),r=n(353),o=n(17),s=n(344);function i(t,e,n){const a=[];!function t(e,n){for(let a=0,r=e.length;a{const{isShowComments:t}=n.$frontmatter,{showComment:e}=n.$themeConfig.valineConfig||{showComment:!0};return!1!==e&&!1!==t||!1===e&&!0===t}),u=Object(a.a)(()=>{const{$themeConfig:{valineConfig:t},$themeLocaleConfig:{valineConfig:e}}=n||{},a=e||t;return a&&0!=a.visitor}),f=Object(a.a)(()=>!1!==n.$themeConfig.lastUpdated&&n.$page.lastUpdated),p=Object(a.a)(()=>"string"==typeof n.$themeLocaleConfig.lastUpdated?n.$themeLocaleConfig.lastUpdated:"string"==typeof n.$themeConfig.lastUpdated?n.$themeConfig.lastUpdated:"Last Updated"),d=Object(a.a)(()=>{const t=n.$frontmatter.prev;return!1===t?void 0:t?Object(o.k)(n.$site.pages,t,n.$route.path):(e=n.$page,a=r.value,i(e,a,-1));var e,a}),h=Object(a.a)(()=>{const t=n.$frontmatter.next;return!1===h?void 0:t?Object(o.k)(n.$site.pages,t,n.$route.path):(e=n.$page,a=r.value,i(e,a,1));var e,a}),g=Object(a.a)(()=>{if(!1===n.$frontmatter.editLink)return!1;const{repo:t,editLinks:e,docsDir:a="",docsBranch:r="master",docsRepo:s=t}=n.$themeConfig;return s&&e&&n.$page.relativePath?function(t,e,n,a,r){if(/bitbucket.org/.test(t)){return(o.i.test(e)?e:t).replace(o.c,"")+"/src"+`/${a}/`+(n?n.replace(o.c,"")+"/":"")+r+`?mode=edit&spa=0&at=${a}&fileviewer=file-view-default`}return(o.i.test(e)?e:"https://github.com/"+e).replace(o.c,"")+"/edit"+`/${a}/`+(n?n.replace(o.c,"")+"/":"")+r}(t,s,a,r,n.$page.relativePath):""}),v=Object(a.a)(()=>n.$themeLocaleConfig.editLinkText||n.$themeConfig.editLinkText||"Edit this page"),m=Object(a.a)(()=>n.$showSubSideBar?{}:{paddingRight:"0"});return{recoShowModule:c,shouldShowComments:l,showAccessNumber:u,lastUpdated:f,lastUpdatedText:p,prev:d,next:h,editLink:g,editLinkText:v,pageStyle:m}}}),l=(n(415),n(2)),u=Object(l.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("main",{staticClass:"page",style:t.pageStyle},[e("section",{directives:[{name:"show",rawName:"v-show",value:t.recoShowModule,expression:"recoShowModule"}]},[e("div",{staticClass:"page-title"},[e("h1",{staticClass:"title"},[t._v(t._s(t.$page.title))]),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.$page,showAccessNumber:t.showAccessNumber}})],1),t._v(" "),e("Content",{staticClass:"theme-reco-content"})],1),t._v(" "),t.recoShowModule?e("footer",{staticClass:"page-edit"},[t.editLink?e("div",{staticClass:"edit-link"},[e("a",{attrs:{href:t.editLink,target:"_blank",rel:"noopener noreferrer"}},[t._v(t._s(t.editLinkText))]),t._v(" "),e("OutboundLink")],1):t._e(),t._v(" "),t.lastUpdated?e("div",{staticClass:"last-updated"},[e("span",{staticClass:"prefix"},[t._v(t._s(t.lastUpdatedText)+": ")]),t._v(" "),e("span",{staticClass:"time"},[t._v(t._s(t.lastUpdated))])]):t._e()]):t._e(),t._v(" "),t.recoShowModule&&(t.prev||t.next)?e("div",{staticClass:"page-nav"},[e("p",{staticClass:"inner"},[t.prev?e("span",{staticClass:"prev"},[t.prev?e("router-link",{staticClass:"prev",attrs:{to:t.prev.path}},[t._v("\n "+t._s(t.prev.title||t.prev.path)+"\n ")]):t._e()],1):t._e(),t._v(" "),t.next?e("span",{staticClass:"next"},[t.next?e("router-link",{attrs:{to:t.next.path}},[t._v("\n "+t._s(t.next.title||t.next.path)+"\n ")]):t._e()],1):t._e()])]):t._e(),t._v(" "),t.recoShowModule?e("Comments",{attrs:{isShowComments:t.shouldShowComments}}):t._e()],1)}),[],!1,null,null,null);e.default=u.exports}}]); \ No newline at end of file diff --git a/assets/js/24.aabe52c9.js b/assets/js/24.aabe52c9.js new file mode 100644 index 0000000..c97dd7b --- /dev/null +++ b/assets/js/24.aabe52c9.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{344:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return o}));r(134);var n=r(0);function s(){const e=Object(n.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function o(){const e=Object(n.h)(!1);return Object(n.e)(()=>{e.value=!0}),Object(n.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},345:function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return d}));var n=r(347),s=r.n(n),o=(r(346),r(0)),i=r(1),a=function(e,t,r,n){var s,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,r,i):s(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};const c=/^(\w+)\-/,l=o.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let f=class extends l{getClass(e){return c.test(e)?e.replace(c,(...e)=>"reco"===e[1]?"iconfont "+e[0]:`${e[1]} ${e[0]}`):e}go(e){""!==e&&window.open(e)}render(){return(0,arguments[0])("i",s()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};f=a([i.b],f);var u=f,p=function(e,t,r,n){var s,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,r,i):s(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};const h=o.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let v=class extends h{setStyle(e){e.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,e.style.transform=this.transform[0],e.style.opacity=0}unsetStyle(e){e.style.transform=this.transform[1],e.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};v=p([i.b],v);var d=v},346:function(e,t,r){"use strict";var n=r(22),s=r(3),o=r(348);n({global:!0},{Reflect:{}}),o(s.Reflect,"Reflect",!0)},347:function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r{var e,t;const n=null==r||null===(e=r.$themeConfig)||void 0===e?void 0:e.valineConfig,s=(null==r||null===(t=r.$themeLocaleConfig)||void 0===t?void 0:t.valineConfig)||n;return s&&0!=s.visitor});return{version:o.a,showAccessNumber:s}}}),c=(r(412),r(2)),l=Object(c.a)(a,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"footer-wrapper"},[t("span",[t("reco-icon",{attrs:{icon:"reco-theme"}}),e._v(" "),t("a",{attrs:{target:"blank",href:"https://vuepress-theme-reco.recoluan.com"}},[e._v(e._s("vuepress-theme-reco@"+e.version))])],1),e._v(" "),e.$themeConfig.record?t("span",[t("reco-icon",{attrs:{icon:"reco-beian"}}),e._v(" "),t("a",{attrs:{href:e.$themeConfig.recordLink||"#"}},[e._v(e._s(e.$themeConfig.record))])],1):e._e(),e._v(" "),t("span",[t("reco-icon",{attrs:{icon:"reco-copyright"}}),e._v(" "),t("a",[e.$themeConfig.author?t("span",[e._v(e._s(e.$themeConfig.author))]):e._e(),e._v("\n   \n "),e.$themeConfig.startYear&&e.$themeConfig.startYear!=(new Date).getFullYear()?t("span",[e._v(e._s(e.$themeConfig.startYear)+" - ")]):e._e(),e._v("\n "+e._s((new Date).getFullYear())+"\n ")])],1),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.showAccessNumber,expression:"showAccessNumber"}]},[t("reco-icon",{attrs:{icon:"reco-eye"}}),e._v(" "),t("AccessNumber",{attrs:{idVal:"/"}})],1),e._v(" "),e.$themeConfig.cyberSecurityRecord?t("p",{staticClass:"cyber-security"},[t("img",{attrs:{src:"https://img.alicdn.com/tfs/TB1..50QpXXXXX7XpXXXXXXXXXX-40-40.png",alt:""}}),e._v(" "),t("a",{attrs:{href:e.$themeConfig.cyberSecurityLink||"#"}},[e._v(e._s(e.$themeConfig.cyberSecurityRecord))])]):e._e(),e._v(" "),t("Comments",{attrs:{isShowComments:!1}})],1)}),[],!1,null,"29dae040",null);t.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/25.d071baf4.js b/assets/js/25.d071baf4.js new file mode 100644 index 0000000..ba61e37 --- /dev/null +++ b/assets/js/25.d071baf4.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[25,30],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return s}));n(134);var r=n(0);function o(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function s(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return y}));var r=n(347),o=n.n(r),s=(n(346),n(0)),a=n(1),i=function(t,e,n,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(a=(s<3?o(a):s>3?o(e,n,a):o(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const l=/^(\w+)\-/,c=s.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends c{getClass(t){return l.test(t)?t.replace(l,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=i([a.b],u);var f=u,d=function(t,e,n,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(a=(s<3?o(a):s>3?o(e,n,a):o(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const p=s.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends p{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=d([a.b],h);var y=h},346:function(t,e,n){"use strict";var r=n(22),o=n(3),s=n(348);r({global:!0},{Reflect:{}}),s(o.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;nObject(o.d)(s.value.link)),l=Object(r.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(t=>t===i.value):"/"===i.value);return{link:i,exact:l,isExternal:o.f,isMailto:o.g,isTel:o.h}}}),l=n(2),c=Object(l.a)(i,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.isExternal(t.link)?e("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.isMailto(t.link)||t.isTel(t.link)?null:"_blank",rel:t.isMailto(t.link)||t.isTel(t.link)?null:"noopener noreferrer"}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n "),e("OutboundLink")],1):e("router-link",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n")],1)}),[],!1,null,null,null);e.default=c.exports},396:function(t,e,n){},414:function(t,e,n){"use strict";n(396)},435:function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(356),s=n(345),a=n(344),i=Object(r.c)({components:{NavLink:o.default,ModuleTransition:s.a},setup(t,e){const n=Object(a.a)();return{recoShowModule:Object(a.b)(),actionLink:Object(r.a)(()=>n&&{link:n.$frontmatter.actionLink,text:n.$frontmatter.actionText}),heroImageStyle:Object(r.a)(()=>n.$frontmatter.heroImageStyle||{maxHeight:"200px",margin:"6rem auto 1.5rem"})}}}),l=(n(414),n(2)),c=Object(l.a)(i,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"home"},[e("div",{staticClass:"hero"},[e("ModuleTransition",[t.recoShowModule&&t.$frontmatter.heroImage?e("img",{style:t.heroImageStyle||{},attrs:{src:t.$withBase(t.$frontmatter.heroImage),alt:"hero"}}):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.04"}},[t.recoShowModule&&null!==t.$frontmatter.heroText?e("h1",{style:{marginTop:t.$frontmatter.heroImage?"0px":"140px"}},[t._v("\n "+t._s(t.$frontmatter.heroText||t.$title||"vuePress-theme-reco")+"\n ")]):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.08"}},[t.recoShowModule&&null!==t.$frontmatter.tagline?e("p",{staticClass:"description"},[t._v("\n "+t._s(t.$frontmatter.tagline||t.$description||"Welcome to your vuePress-theme-reco site")+"\n ")]):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.16"}},[t.recoShowModule&&t.$frontmatter.actionText&&t.$frontmatter.actionLink?e("p",{staticClass:"action"},[e("NavLink",{staticClass:"action-button",attrs:{item:t.actionLink}})],1):t._e()])],1),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.24"}},[t.recoShowModule&&t.$frontmatter.features&&t.$frontmatter.features.length?e("div",{staticClass:"features"},t._l(t.$frontmatter.features,(function(n,r){return e("div",{key:r,staticClass:"feature"},[e("h2",[t._v(t._s(n.title))]),t._v(" "),e("p",[t._v(t._s(n.details))])])})),0):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.32"}},[e("Content",{directives:[{name:"show",rawName:"v-show",value:t.recoShowModule,expression:"recoShowModule"}],staticClass:"home-center",attrs:{custom:""}})],1)],1)}),[],!1,null,null,null);e.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/26.104e5362.js b/assets/js/26.104e5362.js new file mode 100644 index 0000000..06a9225 --- /dev/null +++ b/assets/js/26.104e5362.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));n(134);var r=n(0);function o(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function a(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return g}));var r=n(347),o=n.n(r),a=(n(346),n(0)),s=n(1),i=function(t,e,n,r){var o,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(s=(a<3?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};const c=/^(\w+)\-/,f=a.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends f{getClass(t){return c.test(t)?t.replace(c,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=i([s.b],u);var l=u,p=function(t,e,n,r){var o,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(s=(a<3?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s};const d=a.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let y=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};y=p([s.b],y);var g=y},346:function(t,e,n){"use strict";var r=n(22),o=n(3),a=n(348);r({global:!0},{Reflect:{}}),a(o.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const n=Object(a.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{n.$route.path!==`/tag/${t}/`&&n.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(n.$lang).format(new Date(t))}}}),i=(n(352),n(2)),c=Object(i.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(n,r){return e("span",{key:r,staticClass:"tag-item",class:{active:t.currentTag==n},on:{click:function(e){return e.stopPropagation(),t.goTags(n)}}},[t._v(t._s(n))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/27.e6aed5f1.js b/assets/js/27.e6aed5f1.js new file mode 100644 index 0000000..a5c4320 --- /dev/null +++ b/assets/js/27.e6aed5f1.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return o}));n(134);var r=n(0);function s(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function o(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return u})),n.d(e,"a",(function(){return v}));var r=n(347),s=n.n(r),o=(n(346),n(0)),i=n(1),a=function(t,e,n,r){var s,o=arguments.length,i=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(i=(o<3?s(i):o>3?s(e,n,i):s(e,n))||i);return o>3&&i&&Object.defineProperty(e,n,i),i};const c=/^(\w+)\-/,l=o.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let f=class extends l{getClass(t){return c.test(t)?t.replace(c,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",s()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};f=a([i.b],f);var u=f,p=function(t,e,n,r){var s,o=arguments.length,i=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(i=(o<3?s(i):o>3?s(e,n,i):s(e,n))||i);return o>3&&i&&Object.defineProperty(e,n,i),i};const h=o.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let d=class extends h{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};d=p([i.b],d);var v=d},346:function(t,e,n){"use strict";var r=n(22),s=n(3),o=n(348);r({global:!0},{Reflect:{}}),o(s.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;n(n.$themeConfig.blogConfig&&n.$themeConfig.blogConfig.socialLinks||[]).map(t=>(t.color||(t.color=Object(o.b)()),t)))}}}),c=(n(391),n(2)),l=Object(c.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"personal-info-wrapper"},[t.$themeConfig.authorAvatar?e("img",{staticClass:"personal-img",attrs:{src:t.$withBase(t.$themeConfig.authorAvatar),alt:"author-avatar"}}):t._e(),t._v(" "),t.$themeConfig.author?e("h3",{staticClass:"name"},[t._v("\n "+t._s(t.$themeConfig.author)+"\n ")]):t._e(),t._v(" "),e("div",{staticClass:"num"},[e("div",[e("h3",[t._v(t._s(t.$recoPosts.length))]),t._v(" "),e("h6",[t._v(t._s(t.$recoLocales.article))])]),t._v(" "),e("div",[e("h3",[t._v(t._s(t.$tags.list.length))]),t._v(" "),e("h6",[t._v(t._s(t.$recoLocales.tag))])])]),t._v(" "),e("ul",{staticClass:"social-links"},t._l(t.socialLinks,(function(t,n){return e("li",{key:n,staticClass:"social-item"},[e("reco-icon",{style:{color:t.color},attrs:{icon:t.icon,link:t.link}})],1)})),0),t._v(" "),e("hr")])}),[],!1,null,"1fad0c41",null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/28.be025e1a.js b/assets/js/28.be025e1a.js new file mode 100644 index 0000000..2a69183 --- /dev/null +++ b/assets/js/28.be025e1a.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[28],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return r}));n(134);var s=n(0);function o(){const e=Object(s.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function r(){const e=Object(s.h)(!1);return Object(s.e)(()=>{e.value=!0}),Object(s.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},345:function(e,t,n){"use strict";n.d(t,"b",(function(){return f})),n.d(t,"a",(function(){return y}));var s=n(347),o=n.n(s),r=(n(346),n(0)),i=n(1),a=function(e,t,n,s){var o,r=arguments.length,i=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};const c=/^(\w+)\-/,u=r.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let l=class extends u{getClass(e){return c.test(e)?e.replace(c,(...e)=>"reco"===e[1]?"iconfont "+e[0]:`${e[1]} ${e[0]}`):e}go(e){""!==e&&window.open(e)}render(){return(0,arguments[0])("i",o()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};l=a([i.b],l);var f=l,p=function(e,t,n,s){var o,r=arguments.length,i=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};const d=r.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let h=class extends d{setStyle(e){e.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,e.style.transform=this.transform[0],e.style.opacity=0}unsetStyle(e){e.style.transform=this.transform[1],e.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};h=p([i.b],h);var y=h},346:function(e,t,n){"use strict";var s=n(22),o=n(3),r=n(348);s({global:!0},{Reflect:{}}),r(o.Reflect,"Reflect",!0)},347:function(e,t,n){"use strict";function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t,n=1;no.focused&&c.value&&c.value.length),a=e=>{for(const t in n.$site.locales||{})if("/"!==t&&0===e.path.indexOf(t))return t;return"/"},c=Object(s.a)(()=>{const e=o.query.trim().toLowerCase();if(!e)return;const{pages:t}=n.$site,s=n.$site.themeConfig.searchMaxSuggestions,r=n.$localePath,i=t=>t&&t.title&&t.title.toLowerCase().indexOf(e)>-1,c=[];for(let e=0;e=s);e++){const n=t[e];if(a(n)===r)if(i(n))c.push(n);else if(n.headers)for(let e=0;e=s);e++){const t=n.headers[e];i(t)&&c.push(Object.assign({},n,{path:n.path+"#"+t.slug,header:t}))}}return c}),u=Object(s.a)(()=>(n.$site.themeConfig.nav||[]).length+(n.$site.repo?1:0)<=2);return{showSuggestions:i,suggestions:c,alignRight:u,onUp:()=>{i.value&&(o.focusIndex>0?o.focusIndex--:o.focusIndex=c.value.length-1)},onDown:()=>{i.value&&(o.focusIndex{o.focusIndex=e},unfocus:()=>{o.focusIndex=-1},go:e=>{i.value&&(n.$router.push(c.value[e].path),o.query="",o.focusIndex=0)},...Object(s.i)(o)}},mounted(){this.placeholder=this.$site.themeConfig.searchPlaceholder||""}}),a=(n(404),n(2)),c=Object(a.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"search-box"},[t("reco-icon",{attrs:{icon:"reco-search"}}),e._v(" "),t("input",{ref:"input",class:{focused:e.focused},attrs:{"aria-label":"Search",placeholder:e.placeholder,autocomplete:"off",spellcheck:"false"},domProps:{value:e.query},on:{input:function(t){e.query=t.target.value},focus:function(t){e.focused=!0},blur:function(t){e.focused=!1},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.go(e.focusIndex)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:e.onUp.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:e.onDown.apply(null,arguments)}]}}),e._v(" "),e.showSuggestions?t("ul",{staticClass:"suggestions",class:{"align-right":e.alignRight},on:{mouseleave:e.unfocus}},e._l(e.suggestions,(function(n,s){return t("li",{key:s,staticClass:"suggestion",class:{focused:s===e.focusIndex},on:{mousedown:function(t){return e.go(s)},mouseenter:function(t){return e.focus(s)}}},[t("a",{attrs:{href:n.path},on:{click:function(e){e.preventDefault()}}},[t("span",{staticClass:"page-title"},[e._v(e._s(n.title||n.path))]),e._v(" "),n.header?t("span",{staticClass:"header"},[e._v("> "+e._s(n.header.title))]):e._e()])])})),0):e._e()],1)}),[],!1,null,null,null);t.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/29.7205aae8.js b/assets/js/29.7205aae8.js new file mode 100644 index 0000000..5a93d50 --- /dev/null +++ b/assets/js/29.7205aae8.js @@ -0,0 +1,8 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[29],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return i}));n(134);var r=n(0);function o(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function i(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},361:function(t,e){var n={utf8:{stringToBytes:function(t){return n.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(n.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],n=0;n>>24)|4278255360&(n[d]<<24|n[d]>>>8);n[c>>>5]|=128<>>9<<4)]=c;var h=u._ff,g=u._gg,y=u._hh,v=u._ii;for(d=0;d>>0,l=l+w>>>0,f=f+m>>>0,p=p+_>>>0}return r.endian([a,l,f,p])})._ff=function(t,e,n,r,o,i,s){var u=t+(e&n|~e&r)+(o>>>0)+s;return(u<>>32-i)+e},u._gg=function(t,e,n,r,o,i,s){var u=t+(e&r|n&~r)+(o>>>0)+s;return(u<>>32-i)+e},u._hh=function(t,e,n,r,o,i,s){var u=t+(e^n^r)+(o>>>0)+s;return(u<>>32-i)+e},u._ii=function(t,e,n,r,o,i,s){var u=t+(n^(e|~r))+(o>>>0)+s;return(u<>>32-i)+e},u._blocksize=16,u._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var n=r.wordsToBytes(u(t,e));return e&&e.asBytes?n:e&&e.asString?s.bytesToString(n):r.bytesToHex(n)}},376:function(t,e){var n,r;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(t,e){return t<>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&r.rotl(t,8)|4278255360&r.rotl(t,24);for(var e=0;e0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],n=0,r=0;n>>5]|=t[n]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],n=0;n<32*t.length;n+=8)e.push(t[n>>>5]>>>24-n%32&255);return e},bytesToHex:function(t){for(var e=[],n=0;n>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],n=0;n>>6*(3-i)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,o=0;r>>6-2*o);return e}},t.exports=r},377:function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},395:function(t,e,n){},413:function(t,e,n){"use strict";n(395)},434:function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(375),i=n.n(o),s=n(43),u=n(344);const c=()=>{const t=Object(u.a)(),e=Object(r.h)(!0),n=Object(r.g)({left:0,top:0});return Object(r.e)(()=>{e.value=!/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)}),{popupWindowStyle:n,showDetail:r=>{const o=r.target;o.querySelector(".popup-window-wrapper").style.display="block";const i=o.querySelector(".popup-window"),s=document.querySelector(".info-wrapper"),{clientWidth:u}=o,{clientWidth:c,clientHeight:a}=i;if(e)n.left=(u-c)/2+"px",n.top=-a+"px",s.style.overflow="visible",t.$nextTick(()=>{(t=>{const{offsetWidth:e}=document.body,{x:r,width:o}=t.getBoundingClientRect(),i=e-(r+o);if(i<0){const{offsetLeft:e}=t;n.left=e+i+"px"}})(i)});else{const t=function(t){const e=document,n=t.getBoundingClientRect();let r=n.left,o=n.top;return r+=e.documentElement.scrollLeft||e.body.scrollLeft,o+=e.documentElement.scrollTop||e.body.scrollTop,{left:r,top:o}};s.style.overflow="hidden";const e=t(o).left-t(s).left;n.left=-e+(s.clientWidth-i.clientWidth)/2+"px",n.top=-a+"px"}},hideDetail:t=>{t.target.querySelector(".popup-window-wrapper").style.display="none"}}};var a=Object(r.c)({setup(t,e){const n=Object(u.a)(),{popupWindowStyle:o,showDetail:a,hideDetail:l}=c();return{dataAddColor:Object(r.a)(()=>{const{friendLink:t=[]}=n&&n.$themeConfig;return t.map(t=>(t.color=Object(s.b)(),t))}),popupWindowStyle:o,showDetail:a,hideDetail:l,getImgUrl:t=>{const{logo:e="",email:r=""}=t;return e&&/^http/.test(e)?e:e&&!/^http/.test(e)?n.$withBase(e):`//1.gravatar.com/avatar/${i()(r||"")}?s=50&d=mm&r=x`}}}}),l=(n(413),n(2)),f=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"friend-link-wrapper"},t._l(t.dataAddColor,(function(n,r){return e("div",{key:r,staticClass:"friend-link-item",attrs:{target:"_blank"},on:{mouseenter:function(e){return t.showDetail(e)},mouseleave:function(e){return t.hideDetail(e)}}},[e("span",{staticClass:"list-style",style:{backgroundColor:n.color}}),t._v("\n "+t._s(n.title)+"\n "),e("transition",{attrs:{name:"fade"}},[e("div",{staticClass:"popup-window-wrapper"},[e("div",{ref:"popupWindow",refInFor:!0,staticClass:"popup-window",style:t.popupWindowStyle},[e("div",{staticClass:"logo"},[e("img",{attrs:{src:t.getImgUrl(n)}})]),t._v(" "),e("div",{staticClass:"info"},[e("div",{staticClass:"title"},[e("h4",[t._v(t._s(n.title))]),t._v(" "),e("a",{staticClass:"btn-go",style:{backgroundColor:n.color},attrs:{href:n.link,target:"_blank"}},[t._v("GO")])]),t._v(" "),n.desc?e("p",[t._v(t._s(n.desc))]):t._e()])])])])],1)})),0)}),[],!1,null,"120fcf04",null);e.default=f.exports}}]); \ No newline at end of file diff --git a/assets/js/3.3f12454f.js b/assets/js/3.3f12454f.js new file mode 100644 index 0000000..a346002 --- /dev/null +++ b/assets/js/3.3f12454f.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{349:function(t,e,a){},351:function(t,e,a){},352:function(t,e,a){"use strict";a(349)},353:function(t,e,a){"use strict";a.r(e);a(16);var o=a(0),r=a(345),n=a(344),s=Object(o.c)({components:{RecoIcon:r.b},props:{pageInfo:{type:Object,default:()=>({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const a=Object(n.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{a.$route.path!==`/tag/${t}/`&&a.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(a.$lang).format(new Date(t))}}}),c=(a(352),a(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(a,o){return e("span",{key:o,staticClass:"tag-item",class:{active:t.currentTag==a},on:{click:function(e){return e.stopPropagation(),t.goTags(a)}}},[t._v(t._s(a))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},354:function(t,e,a){},362:function(t,e,a){"use strict";a(351)},363:function(t,e,a){},364:function(t,e,a){"use strict";a.r(e);a(16);var o=a(0),r=a(345),n=a(353),s=Object(o.c)({components:{PageInfo:n.default,RecoIcon:r.b},props:["item","currentPage","currentTag"]}),c=(a(362),a(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports},365:function(t,e,a){"use strict";a(354)},372:function(t,e,a){"use strict";a.r(e);var o=a(0),r={methods:{_getStoragePage(){const t=window.location.pathname,e=JSON.parse(sessionStorage.getItem("currentPage"));return null===e||t!==e.path?(sessionStorage.setItem("currentPage",JSON.stringify({page:1,path:""})),1):parseInt(e.page)},_setStoragePage(t){const e=window.location.pathname;sessionStorage.setItem("currentPage",JSON.stringify({page:t,path:e}))}}},n=a(364),s=a(344),c=Object(o.c)({mixins:[r],components:{NoteAbstractItem:n.default},props:["data","currentTag"],setup(t,e){const a=Object(s.a)(),{data:r}=Object(o.i)(t),n=Object(o.h)(1),c=Object(o.a)(()=>{const t=(n.value-1)*a.$perPage,e=n.value*a.$perPage;return r.value.slice(t,e)});return Object(o.e)(()=>{n.value=a._getStoragePage()||1}),{currentPage:n,currentPageData:c,getCurrentPage:t=>{n.value=t,a._setStoragePage(t),e.emit("paginationChange",t)}}},watch:{$route(){this.currentPage=this._getStoragePage()||1}}}),i=(a(365),a(2)),l=Object(i.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-wrapper"},[t._l(t.currentPageData,(function(a){return e("NoteAbstractItem",{key:a.path,attrs:{item:a,currentPage:t.currentPage,currentTag:t.currentTag}})})),t._v(" "),e("pagation",{staticClass:"pagation",attrs:{total:t.data.length,currentPage:t.currentPage},on:{getCurrentPage:t.getCurrentPage}})],2)}),[],!1,null,"21a20f36",null);e.default=l.exports},378:function(t,e,a){"use strict";a(363)},382:function(t,e,a){"use strict";a.r(e);var o=a(0),r=a(43),n=a(344),s=Object(o.c)({props:{currentTag:{type:String,default:""}},setup(t,e){const a=Object(n.a)();return{tags:Object(o.a)(()=>[{name:a.$recoLocales.all,path:"/tag/"},...a.$tagesList]),tagClick:t=>{e.emit("getCurrentTag",t)},getOneColor:r.b}}}),c=(a(378),a(2)),i=Object(c.a)(s,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"tags"},t._l(t.tags,(function(a,o){return e("span",{directives:[{name:"show",rawName:"v-show",value:!a.pages||a.pages&&a.pages.length>0,expression:"!item.pages || (item.pages && item.pages.length > 0)"}],key:o,class:{active:a.name==t.currentTag},style:{backgroundColor:t.getOneColor()},on:{click:function(e){return t.tagClick(a)}}},[t._v(t._s(a.name))])})),0)}),[],!1,null,"cbf58c6c",null);e.default=i.exports},395:function(t,e,a){},413:function(t,e,a){"use strict";a(395)},423:function(t,e,a){},434:function(t,e,a){"use strict";a.r(e);var o=a(0),r=a(375),n=a.n(r),s=a(43),c=a(344);const i=()=>{const t=Object(c.a)(),e=Object(o.h)(!0),a=Object(o.g)({left:0,top:0});return Object(o.e)(()=>{e.value=!/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)}),{popupWindowStyle:a,showDetail:o=>{const r=o.target;r.querySelector(".popup-window-wrapper").style.display="block";const n=r.querySelector(".popup-window"),s=document.querySelector(".info-wrapper"),{clientWidth:c}=r,{clientWidth:i,clientHeight:l}=n;if(e)a.left=(c-i)/2+"px",a.top=-l+"px",s.style.overflow="visible",t.$nextTick(()=>{(t=>{const{offsetWidth:e}=document.body,{x:o,width:r}=t.getBoundingClientRect(),n=e-(o+r);if(n<0){const{offsetLeft:e}=t;a.left=e+n+"px"}})(n)});else{const t=function(t){const e=document,a=t.getBoundingClientRect();let o=a.left,r=a.top;return o+=e.documentElement.scrollLeft||e.body.scrollLeft,r+=e.documentElement.scrollTop||e.body.scrollTop,{left:o,top:r}};s.style.overflow="hidden";const e=t(r).left-t(s).left;a.left=-e+(s.clientWidth-n.clientWidth)/2+"px",a.top=-l+"px"}},hideDetail:t=>{t.target.querySelector(".popup-window-wrapper").style.display="none"}}};var l=Object(o.c)({setup(t,e){const a=Object(c.a)(),{popupWindowStyle:r,showDetail:l,hideDetail:u}=i();return{dataAddColor:Object(o.a)(()=>{const{friendLink:t=[]}=a&&a.$themeConfig;return t.map(t=>(t.color=Object(s.b)(),t))}),popupWindowStyle:r,showDetail:l,hideDetail:u,getImgUrl:t=>{const{logo:e="",email:o=""}=t;return e&&/^http/.test(e)?e:e&&!/^http/.test(e)?a.$withBase(e):`//1.gravatar.com/avatar/${n()(o||"")}?s=50&d=mm&r=x`}}}}),u=(a(413),a(2)),g=Object(u.a)(l,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"friend-link-wrapper"},t._l(t.dataAddColor,(function(a,o){return e("div",{key:o,staticClass:"friend-link-item",attrs:{target:"_blank"},on:{mouseenter:function(e){return t.showDetail(e)},mouseleave:function(e){return t.hideDetail(e)}}},[e("span",{staticClass:"list-style",style:{backgroundColor:a.color}}),t._v("\n "+t._s(a.title)+"\n "),e("transition",{attrs:{name:"fade"}},[e("div",{staticClass:"popup-window-wrapper"},[e("div",{ref:"popupWindow",refInFor:!0,staticClass:"popup-window",style:t.popupWindowStyle},[e("div",{staticClass:"logo"},[e("img",{attrs:{src:t.getImgUrl(a)}})]),t._v(" "),e("div",{staticClass:"info"},[e("div",{staticClass:"title"},[e("h4",[t._v(t._s(a.title))]),t._v(" "),e("a",{staticClass:"btn-go",style:{backgroundColor:a.color},attrs:{href:a.link,target:"_blank"}},[t._v("GO")])]),t._v(" "),a.desc?e("p",[t._v(t._s(a.desc))]):t._e()])])])])],1)})),0)}),[],!1,null,"120fcf04",null);e.default=g.exports},451:function(t,e,a){t.exports=a.p+"assets/img/bg.2cfdbb33.svg"},452:function(t,e,a){"use strict";a(423)},476:function(t,e,a){"use strict";a.r(e);a(16);var o=a(0),r=a(382),n=a(434),s=a(372),c=a(345),i=a(403),l=a(43),u=a(344),g=Object(o.c)({components:{NoteAbstract:s.default,TagList:r.default,FriendLink:n.default,ModuleTransition:c.a,PersonalInfo:i.default,RecoIcon:c.b},setup(t,e){const r=Object(u.a)(),n=Object(o.g)({recoShow:!1,heroHeight:0}),s=Object(u.b)(),c=Object(o.a)(()=>r.$frontmatter.heroImageStyle||{}),i=Object(o.a)(()=>{const t={textAlign:"center",overflow:"hidden",background:`url(${r.$frontmatter.bgImage?r.$withBase(r.$frontmatter.bgImage):a(451)}) center/cover no-repeat`},{bgImageStyle:e}=r.$frontmatter;return e?{...t,...e}:t});return Object(o.e)(()=>{n.heroHeight=document.querySelector(".hero").clientHeight,n.recoShow=!0}),{recoShowModule:s,heroImageStyle:c,bgImageStyle:i,...Object(o.i)(n),getOneColor:l.b}},methods:{paginationChange(t){setTimeout(()=>{window.scrollTo(0,this.heroHeight)},100)},getPagesByTags(t){this.$router.push({path:t.path})}}}),p=(a(452),a(2)),f=Object(p.a)(g,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"home-blog"},[e("div",{staticClass:"hero",style:{...t.bgImageStyle}},[e("div",[e("ModuleTransition",[t.recoShowModule&&t.$frontmatter.heroImage?e("img",{staticClass:"hero-img",style:t.heroImageStyle||{},attrs:{src:t.$withBase(t.$frontmatter.heroImage),alt:"hero"}}):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.04"}},[t.recoShowModule&&null!==t.$frontmatter.heroText?e("h1",[t._v("\n "+t._s(t.$frontmatter.heroText||t.$title||"vuePress-theme-reco")+"\n ")]):t._e()]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.08"}},[t.recoShowModule&&null!==t.$frontmatter.tagline?e("p",{staticClass:"description"},[t._v("\n "+t._s(t.$frontmatter.tagline||t.$description||"Welcome to your vuePress-theme-reco site")+"\n ")]):t._e()])],1)]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.16"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.recoShowModule,expression:"recoShowModule"}],staticClass:"home-blog-wrapper"},[e("div",{staticClass:"blog-list"},[e("note-abstract",{attrs:{data:t.$recoPosts},on:{paginationChange:t.paginationChange}})],1),t._v(" "),e("div",{staticClass:"info-wrapper"},[e("PersonalInfo"),t._v(" "),e("h4",[e("reco-icon",{attrs:{icon:"reco-category"}}),t._v(" "+t._s(t.$recoLocales.category))],1),t._v(" "),e("ul",{staticClass:"category-wrapper"},t._l(this.$categories.list,(function(a,o){return e("li",{key:o,staticClass:"category-item"},[e("router-link",{attrs:{to:a.path}},[e("span",{staticClass:"category-name"},[t._v(t._s(a.name))]),t._v(" "),e("span",{staticClass:"post-num",style:{backgroundColor:t.getOneColor()}},[t._v(t._s(a.pages.length))])])],1)})),0),t._v(" "),e("hr"),t._v(" "),0!==t.$tags.list.length?e("h4",[e("reco-icon",{attrs:{icon:"reco-tag"}}),t._v(" "+t._s(t.$recoLocales.tag))],1):t._e(),t._v(" "),e("TagList",{on:{getCurrentTag:t.getPagesByTags}}),t._v(" "),t.$themeConfig.friendLink&&0!==t.$themeConfig.friendLink.length?e("h4",[e("reco-icon",{attrs:{icon:"reco-friend"}}),t._v(" "+t._s(t.$recoLocales.friendLink))],1):t._e(),t._v(" "),e("FriendLink")],1)])]),t._v(" "),e("ModuleTransition",{attrs:{delay:"0.24"}},[e("Content",{directives:[{name:"show",rawName:"v-show",value:t.recoShowModule,expression:"recoShowModule"}],staticClass:"home-center",attrs:{custom:""}})],1)],1)}),[],!1,null,null,null);e.default=f.exports}}]); \ No newline at end of file diff --git a/assets/js/30.aa0c8649.js b/assets/js/30.aa0c8649.js new file mode 100644 index 0000000..cd623a2 --- /dev/null +++ b/assets/js/30.aa0c8649.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{344:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return s}));n(134);var r=n(0);function i(){const t=Object(r.d)();if(!t)throw new Error("must be called in setup");return(null==t?void 0:t.proxy)||{}}function s(){const t=Object(r.h)(!1);return Object(r.e)(()=>{t.value=!0}),Object(r.f)(()=>{t.value=!1,setTimeout(()=>{t.value=!0},100)}),{recoShowModule:t}}},345:function(t,e,n){"use strict";n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return b}));var r=n(347),i=n.n(r),s=(n(346),n(0)),o=n(1),a=function(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};const l=/^(\w+)\-/,c=s.b.extend({props:{icon:{type:String,default:""},link:{type:String,default:""}}});let u=class extends c{getClass(t){return l.test(t)?t.replace(l,(...t)=>"reco"===t[1]?"iconfont "+t[0]:`${t[1]} ${t[0]}`):t}go(t){""!==t&&window.open(t)}render(){return(0,arguments[0])("i",i()([{},{class:this.getClass(this.icon),on:{click:this.go.bind(this,this.link)}}]),[this.$slots.default])}};u=a([o.b],u);var f=u,p=function(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};const d=s.b.extend({props:{delay:{type:String,default:"0"},duration:{type:String,default:".25"},transform:{type:Array,default:()=>["translateY(-20px)","translateY(0)"]}}});let y=class extends d{setStyle(t){t.style.transition=`transform ${this.duration}s ease-in-out ${this.delay}s, opacity ${this.duration}s ease-in-out ${this.delay}s`,t.style.transform=this.transform[0],t.style.opacity=0}unsetStyle(t){t.style.transform=this.transform[1],t.style.opacity=1}render(){return(0,arguments[0])("transition",{attrs:{name:"module"},on:{enter:this.setStyle,appear:this.setStyle,"before-leave":this.setStyle,"after-appear":this.unsetStyle,"after-enter":this.unsetStyle}},[this.$slots.default])}};y=p([o.b],y);var b=y},346:function(t,e,n){"use strict";var r=n(22),i=n(3),s=n(348);r({global:!0},{Reflect:{}}),s(i.Reflect,"Reflect",!0)},347:function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e,n=1;nObject(i.d)(s.value.link)),l=Object(r.a)(()=>n.$site.locales?Object.keys(n.$site.locales).some(t=>t===a.value):"/"===a.value);return{link:a,exact:l,isExternal:i.f,isMailto:i.g,isTel:i.h}}}),l=n(2),c=Object(l.a)(a,(function(){var t=this,e=t._self._c;t._self._setupProxy;return t.isExternal(t.link)?e("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.isMailto(t.link)||t.isTel(t.link)?null:"_blank",rel:t.isMailto(t.link)||t.isTel(t.link)?null:"noopener noreferrer"}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n "),e("OutboundLink")],1):e("router-link",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact}},[e("reco-icon",{attrs:{icon:""+t.item.icon}}),t._v("\n "+t._s(t.item.text)+"\n")],1)}),[],!1,null,null,null);e.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/31.634a3a70.js b/assets/js/31.634a3a70.js new file mode 100644 index 0000000..119de65 --- /dev/null +++ b/assets/js/31.634a3a70.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{368:function(o,e,t){},380:function(o,e,t){"use strict";t.d(e,"a",(function(){return c}));var r={light:{"--default-color-10":"rgba(255, 255, 255, 1)","--default-color-9":"rgba(255, 255, 255, .9)","--default-color-8":"rgba(255, 255, 255, .8)","--default-color-7":"rgba(255, 255, 255, .7)","--default-color-6":"rgba(255, 255, 255, .6)","--default-color-5":"rgba(255, 255, 255, .5)","--default-color-4":"rgba(255, 255, 255, .4)","--default-color-3":"rgba(255, 255, 255, .3)","--default-color-2":"rgba(255, 255, 255, .2)","--default-color-1":"rgba(255, 255, 255, .1)","--background-color":"#fff","--box-shadow":"0 1px 8px 0 rgba(0, 0, 0, 0.1)","--box-shadow-hover":"0 2px 16px 0 rgba(0, 0, 0, 0.2)","--text-color":"#242424","--text-color-sub":"#7F7F7F","--border-color":"#eaecef","--code-color":"rgba(27, 31, 35, 0.05)","--mask-color":"#888"},dark:{"--default-color-10":"rgba(0, 0, 0, 1)","--default-color-9":"rgba(0, 0, 0, .9)","--default-color-8":"rgba(0, 0, 0, .8)","--default-color-7":"rgba(0, 0, 0, .7)","--default-color-6":"rgba(0, 0, 0, .6)","--default-color-5":"rgba(0, 0, 0, .5)","--default-color-4":"rgba(0, 0, 0, .4)","--default-color-3":"rgba(0, 0, 0, .3)","--default-color-2":"rgba(0, 0, 0, .2)","--default-color-1":"rgba(0, 0, 0, .1)","--background-color":"#181818","--box-shadow":"0 1px 8px 0 rgba(0, 0, 0, .6)","--box-shadow-hover":"0 2px 16px 0 rgba(0, 0, 0, .7)","--text-color":"rgba(255, 255, 255, .8)","--text-color-sub":"#8B8B8B","--border-color":"rgba(0, 0, 0, .3)","--code-color":"rgba(0, 0, 0, .3)","--mask-color":"#000"}};function a(o){const e=document.querySelector(":root"),t=r[o],a="dark"===o?"light":"dark";for(const o in t)e.style.setProperty(o,t[o]);e.classList.remove(a),e.classList.add(o)}function c(o){if("auto"!==o)return void a(o);const e=window.matchMedia("(prefers-color-scheme: dark)").matches,t=window.matchMedia("(prefers-color-scheme: light)").matches;if(e&&a("dark"),t&&a("light"),!e&&!t){console.log("You specified no preference for a color scheme or your browser does not support it. I schedule dark mode during night time.");const o=(new Date).getHours();a(o<6||o>=18?"dark":"light")}}},387:function(o,e,t){"use strict";t(368)},402:function(o,e,t){"use strict";t.r(e);var r=t(380),a={name:"ModeOptions",data:()=>({modeOptions:[{mode:"dark",title:"dark"},{mode:"auto",title:"auto"},{mode:"light",title:"light"}],currentMode:"auto"}),mounted(){this.currentMode=localStorage.getItem("mode")||this.$themeConfig.mode||"auto";var o=this;window.matchMedia("(prefers-color-scheme: dark)").addListener(()=>{"auto"===o.$data.currentMode&&Object(r.a)(o.$data.currentMode)}),window.matchMedia("(prefers-color-scheme: light)").addListener(()=>{"auto"===o.$data.currentMode&&Object(r.a)(o.$data.currentMode)}),Object(r.a)(this.currentMode)},methods:{selectMode(o){o!==this.currentMode&&(this.currentMode=o,Object(r.a)(o),localStorage.setItem("mode",o))},getClass(o){return o!==this.currentMode?o:o+" active"}}},c=(t(387),t(2)),l=Object(c.a)(a,(function(){var o=this,e=o._self._c;return e("div",{staticClass:"mode-options"},[e("h4",{staticClass:"title"},[o._v("Choose mode")]),o._v(" "),e("ul",{staticClass:"color-mode-options"},o._l(o.modeOptions,(function(t,r){return e("li",{key:r,class:o.getClass(t.mode),on:{click:function(e){return o.selectMode(t.mode)}}},[o._v(o._s(t.title))])})),0)])}),[],!1,null,null,null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/32.e2cc7d59.js b/assets/js/32.e2cc7d59.js new file mode 100644 index 0000000..9cca13b --- /dev/null +++ b/assets/js/32.e2cc7d59.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[32],{344:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return n}));r(134);var s=r(0);function i(){const e=Object(s.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function n(){const e=Object(s.h)(!1);return Object(s.e)(()=>{e.value=!0}),Object(s.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},393:function(e,t,r){},410:function(e,t,r){"use strict";r(393)},438:function(e,t,r){"use strict";r.r(t);var s=r(0),i=r(17),n=r(344),c=Object(s.c)({setup(e,t){const r=Object(n.a)();return{headers:Object(s.a)(()=>r.$showSubSideBar?r.$page.headers:[]),isLinkActive:e=>Object(i.e)(r.$route,r.$page.path+"#"+e.slug)}},render(e){return e("ul",{class:{"sub-sidebar-wrapper":!0},style:{width:this.headers.length>0?"12rem":"0"}},[...this.headers.map(t=>e("li",{class:{active:this.isLinkActive(t),["level-"+t.level]:!0},attr:{key:t.title}},[e("router-link",{class:{"sidebar-link":!0,["reco-side-"+t.slug]:!0},props:{to:`${this.$page.path}#${t.slug}`}},t.title)]))])}}),u=(r(410),r(2)),a=Object(u.a)(c,void 0,void 0,!1,null,"b57cc07c",null);t.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/33.5e8348de.js b/assets/js/33.5e8348de.js new file mode 100644 index 0000000..b35099b --- /dev/null +++ b/assets/js/33.5e8348de.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return r}));n(134);var a=n(0);function c(){const e=Object(a.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function r(){const e=Object(a.h)(!1);return Object(a.e)(()=>{e.value=!0}),Object(a.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},363:function(e,t,n){},378:function(e,t,n){"use strict";n(363)},382:function(e,t,n){"use strict";n.r(t);var a=n(0),c=n(43),r=n(344),s=Object(a.c)({props:{currentTag:{type:String,default:""}},setup(e,t){const n=Object(r.a)();return{tags:Object(a.a)(()=>[{name:n.$recoLocales.all,path:"/tag/"},...n.$tagesList]),tagClick:e=>{t.emit("getCurrentTag",e)},getOneColor:c.b}}}),o=(n(378),n(2)),u=Object(o.a)(s,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"tags"},e._l(e.tags,(function(n,a){return t("span",{directives:[{name:"show",rawName:"v-show",value:!n.pages||n.pages&&n.pages.length>0,expression:"!item.pages || (item.pages && item.pages.length > 0)"}],key:a,class:{active:n.name==e.currentTag},style:{backgroundColor:e.getOneColor()},on:{click:function(t){return e.tagClick(n)}}},[e._v(e._s(n.name))])})),0)}),[],!1,null,"cbf58c6c",null);t.default=u.exports}}]); \ No newline at end of file diff --git a/assets/js/34.2fd21cb8.js b/assets/js/34.2fd21cb8.js new file mode 100644 index 0000000..2aaa718 --- /dev/null +++ b/assets/js/34.2fd21cb8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[34],{470:function(t,a,s){t.exports=s.p+"assets/img/1.0e6521d0.png"},471:function(t,a,s){t.exports=s.p+"assets/img/3.0b39ab89.png"},472:function(t,a,s){t.exports=s.p+"assets/img/5.602dfae7.png"},514:function(t,a,s){"use strict";s.r(a);var e=s(2),n=Object(e.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"支付功能"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#支付功能"}},[t._v("#")]),t._v(" 支付功能")]),t._v(" "),a("p",[t._v("接入支付应该很常见的业务需求,本篇文章将把常见支付渠道流程进行梳理并实现。")]),t._v(" "),a("p",[t._v("在 "),a("code",[t._v("uniapp")]),t._v(" 中要实现支付还是简单,目前他提供两种模式:")]),t._v(" "),a("ul",[a("li",[t._v("requestPayment + 服务端开发(自定义)")]),t._v(" "),a("li",[t._v("requestPayment + uniCloud(云服务) + uniPay")])]),t._v(" "),a("p",[t._v("不管 "),a("code",[t._v("自定义")]),t._v("、"),a("code",[t._v("uniCloud")]),t._v(" 的作用都是对接第三方的平台。 只不过使用 uniCloud 服务,可以直接使用 uniPay 工具,它封装对第三方支付的服务。可以大大提高支付业务的开发效率。这也是官方推荐使用的方式。")]),t._v(" "),a("p",[t._v("目前常用支付方式有:"),a("code",[t._v("微信")]),t._v("、"),a("code",[t._v("支付宝")]),t._v("、"),a("code",[t._v("苹果支付")]),t._v("。 这也是 "),a("code",[t._v("uniapp")]),t._v(" 中 "),a("code",[t._v("Payment Plugin")]),t._v(" 提供支持的几种方式。")]),t._v(" "),a("p",[t._v("虽然 "),a("code",[t._v("uniapp")]),t._v(" 提供开箱即用的 "),a("a",{attrs:{href:"https://uniapp.dcloud.io/api/plugins/payment.html#requestpayment",target:"_blank",rel:"noopener noreferrer"}},[a("code",[t._v("uni.requestPayment")]),a("OutboundLink")],1),t._v(" API 供我们在不同客户的调用支付,但是了解每种支付的流程也是很有必要的,这样可以更好的使用和排查问题。")]),t._v(" "),a("p",[t._v("接下来一一分析各个支付流程。")]),t._v(" "),a("h2",{attrs:{id:"支付宝"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#支付宝"}},[t._v("#")]),t._v(" 支付宝")]),t._v(" "),a("h3",{attrs:{id:"支付宝订单详细结构图"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#支付宝订单详细结构图"}},[t._v("#")]),t._v(" 支付宝订单详细结构图")]),t._v(" "),a("img",{attrs:{src:s(470)}}),t._v(" "),a("h3",{attrs:{id:"客户端大概交互流程"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#客户端大概交互流程"}},[t._v("#")]),t._v(" 客户端大概交互流程")]),t._v(" "),a("img",{attrs:{src:s(471)}}),t._v(" "),a("p",[t._v("在流程熟悉后,现基于 "),a("code",[t._v("uniapp")]),t._v(" 提供的 "),a("code",[t._v("Payment")]),t._v(" 插件, 使用提供 "),a("a",{attrs:{href:"https://uniapp.dcloud.io/api/plugins/payment.html#requestpayment",target:"_blank",rel:"noopener noreferrer"}},[a("code",[t._v("uni.requestPayment(OBJECT)")]),a("OutboundLink")],1),t._v(" 来完成支付功能。")]),t._v(" "),a("p",[t._v("在使用 "),a("code",[t._v("API")]),t._v(" 之前,需要做一些配置工作。 在 "),a("code",[t._v("manifest.json")]),t._v(" 中添加配置")]),t._v(" "),a("p",[t._v("在可视化配置界面中勾选 ☑️ Payment(支付),如下:")]),t._v(" "),a("img",{attrs:{src:s(472)}}),t._v(" "),a("p",[t._v("勾选之后,源码视图中可以看到如下:")]),t._v(" "),a("div",{staticClass:"language-json extra-class"},[a("pre",{pre:!0,attrs:{class:"language-json"}},[a("code",[t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"payment"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"alipay"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"__platform__"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"ios"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n")])])]),a("p",[t._v("此时表示配置成功了,接下来进入到实际的业务代码编写。")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/35.f57d4112.js b/assets/js/35.f57d4112.js new file mode 100644 index 0000000..492a205 --- /dev/null +++ b/assets/js/35.f57d4112.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[35],{350:function(t,e,n){},357:function(t,e,n){"use strict";n.r(e);var s=n(0),i=Object(s.c)({name:"DropdownTransition",setup:(t,e)=>({setHeight:t=>{t.style.height=t.scrollHeight+"px"},unsetHeight:t=>{t.style.height=""}})}),o=(n(358),n(2)),r=Object(o.a)(i,(function(){var t=this._self._c;this._self._setupProxy;return t("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.default=r.exports},358:function(t,e,n){"use strict";n(350)}}]); \ No newline at end of file diff --git a/assets/js/36.2edce414.js b/assets/js/36.2edce414.js new file mode 100644 index 0000000..7921196 --- /dev/null +++ b/assets/js/36.2edce414.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[36],{385:function(t,c,n){},405:function(t,c,n){"use strict";n(385)},437:function(t,c,n){"use strict";n.r(c);n(405);var i=n(2),s=Object(i.a)({},(function(){var t=this,c=t._self._c;return c("div",{staticClass:"sidebar-button",on:{click:function(c){return t.$emit("toggle-sidebar")}}},[c("svg",{staticClass:"icon",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",viewBox:"0 0 448 512"}},[c("path",{attrs:{fill:"currentColor",d:"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"}})])])}),[],!1,null,null,null);c.default=s.exports}}]); \ No newline at end of file diff --git a/assets/js/37.f09aaeb3.js b/assets/js/37.f09aaeb3.js new file mode 100644 index 0000000..5d543c0 --- /dev/null +++ b/assets/js/37.f09aaeb3.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[37],{360:function(e,t,n){},374:function(e,t,n){"use strict";n(360)},383:function(e,t,n){"use strict";n.r(t);var i=n(0),a=n(17);var s=Object(i.c)({functional:!0,props:["item","sidebarDepth"],render(e,{parent:{$page:t,$site:n,$route:i,$themeConfig:s,$themeLocaleConfig:o},props:{item:r,sidebarDepth:c}}){const p=Object(a.e)(i,r.path),u="auto"===r.type?p||r.children.some(e=>Object(a.e)(i,r.basePath+"#"+e.slug)):p;return function(e,t,n,i){return e("router-link",{props:{to:t,activeClass:"",exactActiveClass:""},class:{active:i,"sidebar-link":!0}},n)}(e,r.path,r.title||r.path,u)}}),o=(n(374),n(2)),r=Object(o.a)(s,void 0,void 0,!1,null,null,null);t.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/38.0ffef7c2.js b/assets/js/38.0ffef7c2.js new file mode 100644 index 0000000..4863228 --- /dev/null +++ b/assets/js/38.0ffef7c2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[38],{459:function(t,s,a){t.exports=a.p+"assets/img/Channel.f9adc640.png"},460:function(t,s,a){t.exports=a.p+"assets/img/umeng.f2cd3e1e.png"},497:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"构建不同-channel-包"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#构建不同-channel-包"}},[t._v("#")]),t._v(" 构建不同 Channel 包")]),t._v(" "),s("h2",{attrs:{id:"使用-uniapp-内置的"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#使用-uniapp-内置的"}},[t._v("#")]),t._v(" 使用 uniapp 内置的")]),t._v(" "),s("p",[t._v("对应 HBuilderX 下,Menu > Build > Cloud Packaging")]),t._v(" "),s("img",{attrs:{src:a(459)}}),t._v(" "),s("p",[t._v("如上图所示:")]),t._v(" "),s("p",[t._v("HBuilderX 默认提供 7 个渠道(Google、360、小米、华为、应用宝、vivo、oppo),更多可以在manifest.json文件中【源码视图】进行配置。")]),t._v(" "),s("table",[s("thead",[s("tr",[s("th",[t._v("默认渠道")]),t._v(" "),s("th",[t._v("渠道标识ID")])])]),t._v(" "),s("tbody",[s("tr",[s("td",[t._v("GooglePlay")]),t._v(" "),s("td",[t._v("google")])]),t._v(" "),s("tr",[s("td",[t._v("应用宝")]),t._v(" "),s("td",[t._v("yyb")])]),t._v(" "),s("tr",[s("td",[t._v("360应用市场")]),t._v(" "),s("td",[t._v("360")])]),t._v(" "),s("tr",[s("td",[t._v("华为应用商店")]),t._v(" "),s("td",[t._v("huawei")])]),t._v(" "),s("tr",[s("td",[t._v("小米应用商店")]),t._v(" "),s("td",[t._v("xiaomi")])]),t._v(" "),s("tr",[s("td",[t._v("vivo应用商店")]),t._v(" "),s("td",[t._v("vivo")])]),t._v(" "),s("tr",[s("td",[t._v("oppo应用商店")]),t._v(" "),s("td",[t._v("oppo")])])])]),t._v(" "),s("p",[t._v("注意:提交谷歌应用市场(Google Play)时一定要将渠道标识设置为google,即一定要选择打包界面里的google渠道,否则会无法提交到play store")]),t._v(" "),s("h2",{attrs:{id:"自定义-channel-包"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#自定义-channel-包"}},[t._v("#")]),t._v(" 自定义 Channel 包")]),t._v(" "),s("p",[t._v("默认的渠道数量不够使,想要更多渠道?")]),t._v(" "),s("p",[t._v("在 manifest.json【源码视图】中, 根节点增加 "),s("code",[t._v("channel_list")]),t._v(" 字段.")]),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"channel_list"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"id"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("blockquote",[s("p",[t._v("注意,"),s("code",[t._v("channel_list")]),t._v(" 添加在根节点")])]),t._v(" "),s("p",[t._v("比如:")]),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"channel_list"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"id"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"chuizi"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"锤子应用市场"')]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(",\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"id"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"meizu"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"魅族应用市场"')]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("配置后会在上面的云端打包界面显示自定义渠道,提交云端打包时需要勾选才能生效。")]),t._v(" "),s("h2",{attrs:{id:"代码中根据不同渠道添加个性化参数或功能"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#代码中根据不同渠道添加个性化参数或功能"}},[t._v("#")]),t._v(" 代码中根据不同渠道添加个性化参数或功能")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 获取渠道 ID")]),t._v("\nplus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("channel\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 此方法可获取基本的app信息,如版本号,名称等")]),t._v("\nplus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime\n")])])]),s("h2",{attrs:{id:"整合-umeng-对不同的渠道包进行数据分析"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#整合-umeng-对不同的渠道包进行数据分析"}},[t._v("#")]),t._v(" 整合 "),s("code",[t._v("umeng")]),t._v(" 对不同的渠道包进行数据分析")]),t._v(" "),s("p",[t._v("默认 "),s("code",[t._v("HbulderX")]),t._v(" 中提供对"),s("code",[t._v("友盟SDK")]),t._v("支持,在使用时只需要通过简单的配置即可。")]),t._v(" "),s("p",[t._v("首先打开 "),s("code",[t._v("manifest.json")]),t._v(" 的可视化视图界面,进入 "),s("code",[t._v("App模块配置")]),t._v(" -> "),s("code",[t._v("勾选 Statistic")]),t._v(" -> "),s("code",[t._v("再勾选 友盟统计")]),t._v(" 如下:")]),t._v(" "),s("img",{attrs:{src:a(460)}}),t._v(" "),s("p",[t._v("从上图中可以看到需要填写项 "),s("code",[t._v("appkey_ios")]),t._v("、"),s("code",[t._v("channelid_ios")]),t._v(" 、"),s("code",[t._v("appkey_android")]),t._v("、"),s("code",[t._v("channelid_android")]),t._v(",其中 "),s("code",[t._v("appkey_ios")]),t._v("、"),s("code",[t._v("channelid_android")]),t._v(" 是必填项。 对应的是您在 "),s("a",{attrs:{href:"https://mobile.umeng.com/platform/apps/list",target:"_blank",rel:"noopener noreferrer"}},[t._v("友盟后台"),s("OutboundLink")],1),t._v(" 申请的应用ID。")]),t._v(" "),s("p",[s("code",[t._v("channelid_ios")]),t._v(","),s("code",[t._v("channelid_android")]),t._v(" 可选,属性的作用用于区分来自不同渠道 APP。ios 基本只有一个渠道,android 渠道相应多点,比如"),s("code",[t._v("应用宝")]),t._v("、"),s("code",[t._v("华为")]),t._v("、"),s("code",[t._v("小米")]),t._v("、"),s("code",[t._v("viov")]),t._v("、"),s("code",[t._v("oppe")]),t._v(" 等。")]),t._v(" "),s("p",[t._v("同样进入可视化视图之后可以看到如下配置内容:")]),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"sdkConfigs"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"statics"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"umeng"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"appkey_ios"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"******************"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"channelid_ios"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"iOS平台的渠道字符串,可输入任意字符串"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"appkey_android"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"******************"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"channelid_android"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"huawei"')]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("集成成功之后,开始进行进入 "),s("code",[t._v("coding")]),t._v(" 阶段,那么在代码中如何进行数据的上报呢 ? "),s("a",{attrs:{href:"https://www.html5plus.org/doc/zh_cn/statistic.html",target:"_blank",rel:"noopener noreferrer"}},[s("code",[t._v("plus.statistic")]),s("OutboundLink")],1),t._v("。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("statistic"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("eventTrig")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"eventName"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"事件参数"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("eventName: 是在友盟定义的事件名称。")]),t._v(" "),s("li",[t._v("params: 自定义,需要上报到友盟的数据体。")])]),t._v(" "),s("blockquote",[s("p",[t._v("⚠️注意:配置完成后,要用自己的 app 证书等信息,打包自定义调试基座,或者云打包正式 app 后才能生效。")])]),t._v(" "),s("h2",{attrs:{id:"注意事项"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#注意事项"}},[t._v("#")]),t._v(" 注意事项")]),t._v(" "),s("ul",[s("li",[t._v("uniapp 进行云打包的时候,如果友盟上报需要区分不同渠道,则需要一个一个进行打包。")]),t._v(" "),s("li",[t._v("uniapp 上报的数据实时性的问题,友盟对于部分数据时性需要是付费用户。 当天上报的可能存在看不到的现象。")])]),t._v(" "),s("h2",{attrs:{id:"参考"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#参考"}},[t._v("#")]),t._v(" 参考")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://tongji.dcloud.net.cn/",target:"_blank",rel:"noopener noreferrer"}},[t._v("uni-app如何在uni统计后台查看渠道数据"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://ask.dcloud.net.cn/article/35974",target:"_blank",rel:"noopener noreferrer"}},[t._v("云打包如何打渠道包"),s("OutboundLink")],1)])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/39.8a7a1d21.js b/assets/js/39.8a7a1d21.js new file mode 100644 index 0000000..be56a8b --- /dev/null +++ b/assets/js/39.8a7a1d21.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[39],{462:function(t,s,a){t.exports=a.p+"assets/img/1.5b9dd891.png"},463:function(t,s,a){t.exports=a.p+"assets/img/2.ef3d5dcb.png"},507:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"h5-与-webview-交互"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#h5-与-webview-交互"}},[t._v("#")]),t._v(" H5 与 webview 交互")]),t._v(" "),s("p",[s("code",[t._v("web-view")]),t._v(" 是一个 web 浏览器组件,可以用来承载网页的容器,会自动铺满整个页面("),s("code",[t._v("nvue")]),t._v(" 使用需要手动指定宽高).")]),t._v(" "),s("h2",{attrs:{id:"基本使用"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#基本使用"}},[t._v("#")]),t._v(" 基本使用")]),t._v(" "),s("div",{staticClass:"language-html extra-class"},[s("pre",{pre:!0,attrs:{class:"language-html"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("web-view")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("src")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("https://www.baidu.com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n")])])]),s("p",[s("code",[t._v("web-view")]),t._v(" 组件详细使用,可以参考官方 "),s("a",{attrs:{href:"https://uniapp.dcloud.io/component/web-view.html",target:"_blank",rel:"noopener noreferrer"}},[s("code",[t._v("web-view")]),s("OutboundLink")],1),t._v(". 在 uniapp 中 "),s("code",[t._v("web-view")]),t._v(" 可设置属性并没详细罗列,需要参考 "),s("a",{attrs:{href:"https://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.WebviewStyles",target:"_blank",rel:"noopener noreferrer"}},[s("code",[t._v("html5plus")]),s("OutboundLink")],1),t._v("。")]),t._v(" "),s("p",[t._v("下面通过一个实际案例来了解它们的使用。")]),t._v(" "),s("h2",{attrs:{id:"实际案例"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#实际案例"}},[t._v("#")]),t._v(" 实际案例")]),t._v(" "),s("p",[t._v("在开发 "),s("code",[t._v("51趣味营销")]),t._v(" 活动的时候,活动页是通过单独 "),s("code",[t._v("h5")]),t._v(" 开发的。开发的 "),s("code",[t._v("h5")]),t._v(" 页面需要嵌入到 "),s("code",[t._v("app")]),t._v(" 、"),s("code",[t._v("微信")]),t._v("、"),s("code",[t._v("公众号")]),t._v(" 中进行营销。")]),t._v(" "),s("p",[t._v("既然需要嵌入到 "),s("code",[t._v("app")]),t._v(" 中,那么就需要使用到 "),s("code",[t._v("web-view")]),t._v(" 组件。")]),t._v(" "),s("p",[t._v("先来说下 "),s("code",[t._v("h5")]),t._v(" 中包含那些需要与 "),s("code",[t._v("app")]),t._v(" 交互的内容,"),s("code",[t._v("微信朋友分享")]),t._v("、"),s("code",[t._v("微信朋友圈分享")]),t._v("、"),s("code",[t._v("一键获取干货")]),t._v("(打开小程序)。")]),t._v(" "),s("img",{attrs:{src:a(462)}}),t._v(" "),s("img",{attrs:{src:a(463)}}),t._v(" "),s("p",[t._v("知道内容之后,可以开始探索一下如何完成接入、微信分享、唤醒小程序。")]),t._v(" "),s("h3",{attrs:{id:"_3-1-利用-webview-加载-h5"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-1-利用-webview-加载-h5"}},[t._v("#")]),t._v(" 3.1 利用 webview 加载 h5")]),t._v(" "),s("div",{staticClass:"language-html extra-class"},[s("pre",{pre:!0,attrs:{class:"language-html"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("view")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("container"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("web-view")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("@message")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v(" "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v(":src")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("src"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token script"}},[s("span",{pre:!0,attrs:{class:"token language-javascript"}},[t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" wv"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("src")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onLoad")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("options")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("src "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("src"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// #ifdef APP-PLUS")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 此对象相当于 html5plus 里的 plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" currentWebview "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("$scope"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("$getAppWebview")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("$getAppWebview")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n wv "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" currentWebview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("children")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n wv"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setStyle")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("scalable")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("false")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("200")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//如果是页面初始化调用时,需要延时一下")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// #endif")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n")])])]),s("p",[t._v("这样基本上,就")]),t._v(" "),s("h3",{attrs:{id:"_3-2-引入-uni-webview-js"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-2-引入-uni-webview-js"}},[t._v("#")]),t._v(" 3.2 引入 uni.webview.js")]),t._v(" "),s("h3",{attrs:{id:"_3-3-唤醒微信"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-3-唤醒微信"}},[t._v("#")]),t._v(" 3.3 唤醒微信")]),t._v(" "),s("h2",{attrs:{id:"附录"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#附录"}},[t._v("#")]),t._v(" 附录")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://zhuanlan.zhihu.com/p/58691238",target:"_blank",rel:"noopener noreferrer"}},[t._v("你真的了解 webview 么"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.WebviewStyles",target:"_blank",rel:"noopener noreferrer"}},[t._v("html5plus"),s("OutboundLink")],1)])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/4.000937d4.js b/assets/js/4.000937d4.js new file mode 100644 index 0000000..c58bb77 --- /dev/null +++ b/assets/js/4.000937d4.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{349:function(t,e,a){},351:function(t,e,a){},352:function(t,e,a){"use strict";a(349)},353:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(344),c=Object(r.c)({components:{RecoIcon:n.b},props:{pageInfo:{type:Object,default:()=>({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const a=Object(s.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{a.$route.path!==`/tag/${t}/`&&a.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(a.$lang).format(new Date(t))}}}),o=(a(352),a(2)),i=Object(o.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(a,r){return e("span",{key:r,staticClass:"tag-item",class:{active:t.currentTag==a},on:{click:function(e){return e.stopPropagation(),t.goTags(a)}}},[t._v(t._s(a))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},354:function(t,e,a){},355:function(t,e,a){},362:function(t,e,a){"use strict";a(351)},363:function(t,e,a){},364:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(353),c=Object(r.c)({components:{PageInfo:s.default,RecoIcon:n.b},props:["item","currentPage","currentTag"]}),o=(a(362),a(2)),i=Object(o.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports},365:function(t,e,a){"use strict";a(354)},366:function(t,e,a){"use strict";a(355)},371:function(t,e,a){},372:function(t,e,a){"use strict";a.r(e);var r=a(0),n={methods:{_getStoragePage(){const t=window.location.pathname,e=JSON.parse(sessionStorage.getItem("currentPage"));return null===e||t!==e.path?(sessionStorage.setItem("currentPage",JSON.stringify({page:1,path:""})),1):parseInt(e.page)},_setStoragePage(t){const e=window.location.pathname;sessionStorage.setItem("currentPage",JSON.stringify({page:t,path:e}))}}},s=a(364),c=a(344),o=Object(r.c)({mixins:[n],components:{NoteAbstractItem:s.default},props:["data","currentTag"],setup(t,e){const a=Object(c.a)(),{data:n}=Object(r.i)(t),s=Object(r.h)(1),o=Object(r.a)(()=>{const t=(s.value-1)*a.$perPage,e=s.value*a.$perPage;return n.value.slice(t,e)});return Object(r.e)(()=>{s.value=a._getStoragePage()||1}),{currentPage:s,currentPageData:o,getCurrentPage:t=>{s.value=t,a._setStoragePage(t),e.emit("paginationChange",t)}}},watch:{$route(){this.currentPage=this._getStoragePage()||1}}}),i=(a(365),a(2)),u=Object(i.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-wrapper"},[t._l(t.currentPageData,(function(a){return e("NoteAbstractItem",{key:a.path,attrs:{item:a,currentPage:t.currentPage,currentTag:t.currentTag}})})),t._v(" "),e("pagation",{staticClass:"pagation",attrs:{total:t.data.length,currentPage:t.currentPage},on:{getCurrentPage:t.getCurrentPage}})],2)}),[],!1,null,"21a20f36",null);e.default=u.exports},378:function(t,e,a){"use strict";a(363)},382:function(t,e,a){"use strict";a.r(e);var r=a(0),n=a(43),s=a(344),c=Object(r.c)({props:{currentTag:{type:String,default:""}},setup(t,e){const a=Object(s.a)();return{tags:Object(r.a)(()=>[{name:a.$recoLocales.all,path:"/tag/"},...a.$tagesList]),tagClick:t=>{e.emit("getCurrentTag",t)},getOneColor:n.b}}}),o=(a(378),a(2)),i=Object(o.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"tags"},t._l(t.tags,(function(a,r){return e("span",{directives:[{name:"show",rawName:"v-show",value:!a.pages||a.pages&&a.pages.length>0,expression:"!item.pages || (item.pages && item.pages.length > 0)"}],key:r,class:{active:a.name==t.currentTag},style:{backgroundColor:t.getOneColor()},on:{click:function(e){return t.tagClick(a)}}},[t._v(t._s(a.name))])})),0)}),[],!1,null,"cbf58c6c",null);e.default=i.exports},398:function(t,e,a){"use strict";a(371)},426:function(t,e,a){},455:function(t,e,a){"use strict";a(426)},484:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(399),s=a(372),c=a(382),o=a(27),i=a(344),u=Object(r.c)({components:{Common:n.default,NoteAbstract:s.default,TagList:c.default},setup(t,e){const a=Object(i.a)();return{posts:Object(r.a)(()=>{let t=a.$currentTags.pages;return t=Object(o.a)(t),Object(o.c)(t),t}),getCurrentTag:t=>{e.emit("currentTag",t)},tagClick:t=>{a.$route.path!==t.path&&a.$router.push({path:t.path})},paginationChange:t=>{setTimeout(()=>{window.scrollTo(0,0)},100)}}}}),g=(a(366),a(398),a(455),a(2)),l=Object(g.a)(u,(function(){var t=this._self._c;this._self._setupProxy;return t("Common",{staticClass:"tag-wrapper",attrs:{sidebar:!1}},[t("TagList",{staticClass:"tags",attrs:{currentTag:this.$currentTags.key},on:{getCurrentTag:this.tagClick}}),this._v(" "),t("note-abstract",{staticClass:"list",attrs:{data:this.posts,currentTag:this.$currentTags.key},on:{paginationChange:this.paginationChange}})],1)}),[],!1,null,"c29f409a",null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/40.4c6d7e47.js b/assets/js/40.4c6d7e47.js new file mode 100644 index 0000000..b7f7ae7 --- /dev/null +++ b/assets/js/40.4c6d7e47.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[40],{464:function(e,t,a){e.exports=a.p+"assets/img/keystore.a6e16c85.png"},465:function(e,t,a){e.exports=a.p+"assets/img/package.12251589.png"},508:function(e,t,a){"use strict";a.r(t);var s=a(2),v=Object(s.a)({},(function(){var e=this,t=e._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("h1",{attrs:{id:"生成签名"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#生成签名"}},[e._v("#")]),e._v(" 生成签名")]),e._v(" "),t("h2",{attrs:{id:"签名是什么"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#签名是什么"}},[e._v("#")]),e._v(" 签名是什么")]),e._v(" "),t("p",[t("a",{attrs:{href:"https://www.jianshu.com/p/644ddb6e3d9c",target:"_blank",rel:"noopener noreferrer"}},[e._v("Android Keystore 漫谈"),t("OutboundLink")],1)]),e._v(" "),t("h2",{attrs:{id:"生成签名-2"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#生成签名-2"}},[e._v("#")]),e._v(" 生成签名")]),e._v(" "),t("ul",[t("li",[e._v("通过 JDK")]),e._v(" "),t("li",[e._v("Android Studio")])]),e._v(" "),t("p",[e._v("首先通过 JDK 的方式来生成,大概的步骤的如下")]),e._v(" "),t("h3",{attrs:{id:"安装-jdk"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#安装-jdk"}},[e._v("#")]),e._v(" 安装 JDK")]),e._v(" "),t("p",[e._v("对于 "),t("code",[e._v("Mac")]),e._v(" 用户而言,可以通过 "),t("code",[e._v("Mac")]),e._v(" 的 "),t("code",[e._v("brew")]),e._v(" 来快捷安装。")]),e._v(" "),t("p",[e._v("进入 terminal ,输入如下命令")]),e._v(" "),t("div",{staticClass:"language-shell extra-class"},[t("pre",{pre:!0,attrs:{class:"language-shell"}},[t("code",[e._v("brew tap AdoptOpenJDK/openjdk\nbrew "),t("span",{pre:!0,attrs:{class:"token function"}},[e._v("install")]),e._v(" adoptopenjdk8 // 此处写java8会提示找不到\n\n"),t("span",{pre:!0,attrs:{class:"token function"}},[e._v("java")]),e._v(" // 检测是否安装成功\n")])])]),t("h3",{attrs:{id:"借助-keytool-生成-keystore"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#借助-keytool-生成-keystore"}},[e._v("#")]),e._v(" 借助 Keytool 生成 Keystore")]),e._v(" "),t("blockquote",[t("p",[e._v("keytool -genkey -keyalg RSA -alias mykeystore -keystore mykeystore.jks -storepass 12345678 -validity 360")])]),e._v(" "),t("p",[e._v("上面每个 keytool 表示:")]),e._v(" "),t("ul",[t("li",[e._v("-genkey: 此命令用于生成密钥")]),e._v(" "),t("li",[e._v("-keyalg RSA: 生成密码使用算法")]),e._v(" "),t("li",[e._v("-alias mykeystore: 产生别名,后面跟别名内容。若未指定,则别名默认为 mykey.")]),e._v(" "),t("li",[e._v("-keysotre mykeystore.jks : 这表示您正在创建或已经使用的 keystore 的名称。")]),e._v(" "),t("li",[e._v("storepass : 指定 keystore 密码")]),e._v(" "),t("li",[e._v("-validity : 指定生成密钥的使用有效期,单位为天")])]),e._v(" "),t("p",[e._v("在命令行输入上面命令后,则在控制台依次需要输入如下内容:")]),e._v(" "),t("ul",[t("li",[e._v("CN:名字或姓氏")]),e._v(" "),t("li",[e._v("OU:组织单位名称")]),e._v(" "),t("li",[e._v("O:组织名称")]),e._v(" "),t("li",[e._v("L:城市或区域名称")]),e._v(" "),t("li",[e._v("ST:州或省份名称")]),e._v(" "),t("li",[e._v("C:单位的两字国家代码")])]),e._v(" "),t("img",{attrs:{src:a(464)}}),e._v(" "),t("p",[e._v("这样基本上完成 keystore 的生成,接下来我们可以去 "),t("code",[e._v("HBuilderX")]),e._v(" 中浅尝一下打包。")]),e._v(" "),t("h2",{attrs:{id:"android-签名"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#android-签名"}},[e._v("#")]),e._v(" Android 签名")]),e._v(" "),t("p",[e._v("进入菜单 "),t("code",[e._v("Menu")]),e._v(" > "),t("code",[e._v("Build")]),e._v(" > 选择 "),t("code",[e._v("MobileApp - Cloud Packaging")]),e._v("。")]),e._v(" "),t("img",{attrs:{src:a(465)}})])}),[],!1,null,null,null);t.default=v.exports}}]); \ No newline at end of file diff --git a/assets/js/41.901f21ed.js b/assets/js/41.901f21ed.js new file mode 100644 index 0000000..f927b11 --- /dev/null +++ b/assets/js/41.901f21ed.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[41],{466:function(t,s,a){t.exports=a.p+"assets/img/1.81c4c495.jpeg"},467:function(t,s,a){t.exports=a.p+"assets/img/2.d7f5a561.png"},509:function(t,s,a){"use strict";a.r(s);var n=a(2),p=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"登录"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#登录"}},[t._v("#")]),t._v(" 登录")]),t._v(" "),s("h2",{attrs:{id:"_1-小程序登录"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-小程序登录"}},[t._v("#")]),t._v(" 1. 小程序登录")]),t._v(" "),s("p",[t._v("小程序有两种登录方式,一种基于手机号码进行登录,另一种是使用用户在公众号下的唯一标识(openid)进行登录(小程序是公众号的一种).")]),t._v(" "),s("p",[t._v("接下来先讲解下,基于 openid 登录。")]),t._v(" "),s("h3",{attrs:{id:"_1-1-基于-openid-登录"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-1-基于-openid-登录"}},[t._v("#")]),t._v(" 1.1 基于 openid 登录")]),t._v(" "),s("p",[t._v("先看下图,描述通过微信小程序提供的 code 换取当前用户在小程序中的唯一标识,详细流程可以参数下图:")]),t._v(" "),s("img",{attrs:{src:a(466)}}),t._v(" "),s("p",[t._v("接下来通过代码实现下大概流程:")]),t._v(" "),s("ul",[s("li",[t._v("获取 code")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("login")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("errMsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'login:ok'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" data "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("login")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 保存用户信息")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("e")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" e"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("服务端接收 code 去微信后台换取对应 openid")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// nodejs 部分代码")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" grant_type "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'../config/wx'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nrouter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/login'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" grant_type "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'../config/wx'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" openid "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/sns/jscode2session'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("js_code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n grant_type"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("在数据库中查找对应 openid 是否存在")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" grant_type "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'../config/wx'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nrouter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/login'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 1. 获取 code")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 2. 通过 code 获取 openid 和 session_key")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" openid "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/sns/jscode2session'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("js_code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n grant_type"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3. 查找用户是否已经注册")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("findOne")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("where")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n openid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3.2 如果用户已经注册,返回用户信息")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3.3 如果用户没有注册,创建用户并返回用户信息")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" username "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("randomUserName")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("nickname")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" username"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n openid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("avatar")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/uploads/default-avatar.png'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("上面就是一个基于 "),s("code",[t._v("code")]),t._v(" 获取 "),s("code",[t._v("openid")]),t._v(",并通过 "),s("code",[t._v("openid")]),t._v(" 创建新的用户,并将创建好的用户返回。")]),t._v(" "),s("p",[t._v("为了方便理解,这里简化描述了登录逻辑。在实际业务代码中,通常会使用 "),s("code",[t._v("openid")]),t._v(" 、 "),s("code",[t._v("session key")]),t._v(" 和用户信息来创建自定义登录凭证(token),并在登录时将用户信息和 "),s("code",[t._v("token")]),t._v(" 一起返回给前端。前端会将 "),s("code",[t._v("token")]),t._v(" 存储在本地,并在下一次需要登录的业务请求中携带 "),s("code",[t._v("token")]),t._v(",从而实现业务鉴权的功能。这种方式通常使用 "),s("code",[t._v("JWT(JSON Web Token)")]),t._v("等工具来实现。在后续的讲解中,我们将详细介绍这些概念和技术细节。")]),t._v(" "),s("h3",{attrs:{id:"_1-2-手机号码快捷登录"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-2-手机号码快捷登录"}},[t._v("#")]),t._v(" 1.2 手机号码快捷登录")]),t._v(" "),s("p",[t._v("获取手机号码的前提:")]),t._v(" "),s("ul",[s("li",[t._v("非个人小程序")]),t._v(" "),s("li",[t._v("认证的小程序")]),t._v(" "),s("li",[t._v("非海外的企业认证")])]),t._v(" "),s("p",[t._v("下面是大概业务流程图:")]),t._v(" "),s("img",{attrs:{src:a(467)}}),t._v(" "),s("h4",{attrs:{id:"_1-2-1-获取对应-code"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-2-1-获取对应-code"}},[t._v("#")]),t._v(" 1.2.1 获取对应 code")]),t._v(" "),s("div",{staticClass:"language-vue extra-class"},[s("pre",{pre:!0,attrs:{class:"language-vue"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("button")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("login-btn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("open-type")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("@getphonenumber")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n 手机号码登录\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token script"}},[s("span",{pre:!0,attrs:{class:"token language-javascript"}},[t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setup")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 目前该接口针对非个人开发者,且完成了认证的小程序开放(不包含海外主体)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("getPhoneNumber")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("e")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" errMsg "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" e"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("detail"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("errMsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'getPhoneNumber:ok'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" data "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("loginByPhone")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" errMsg"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])]),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n")])])]),s("h4",{attrs:{id:"_1-2-2-后端处理逻辑"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-2-2-后端处理逻辑"}},[t._v("#")]),t._v(" 1.2.2 后端处理逻辑")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 基于手机号登录")]),t._v("\nrouter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/loginByPhone'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("try")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 1. 获取 code 和 loginCode")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("body"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 2. 获取接口调用凭据,理论上这里需要缓存 access_token,避免频繁调用接口")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" access_token "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/cgi-bin/token'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("grant_type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'client_credential'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3. 获取手机号")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" phone_info "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("/wxa/business/getuserphonenumber?access_token=")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("access_token"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 4. 查找用户是否已经注册")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 4.1 根据 phone 查找用户")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" purePhoneNumber "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" phone_info"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("findOne")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("where")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n purePhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 4.2 如果用户已经注册,返回用户信息")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 4.3 如果用户没有注册,创建用户并返回用户信息")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" username "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("randomUserName")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("nickname")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" username"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("avatar")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/uploads/default-avatar.png'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("phone")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" phone_info"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("purePhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("catch")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'BIZ_ERROR'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("errmsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("上面代码,实现获取手机号码并使用手机号码作为唯一标识,进行用户创建和查找的操作。")]),t._v(" "),s("p",[t._v("从登录的角度来看,使用手机号码作为唯一标识符是没有问题的。然而,如果用户尝试使用非手机号码(例如 "),s("code",[t._v("OpenID")]),t._v(")进行登录,并在数据库中找不到匹配的记录时,系统会创建一个新的账号。这可能导致同一个用户在系统中存在多个账号的情况。")]),t._v(" "),s("p",[t._v("为了优化这种情况,可以考虑以下几种方法:")]),t._v(" "),s("ul",[s("li",[t._v("当用户使用 "),s("code",[t._v("openid")]),t._v(" 登录后,检测未绑定手机号码时,进行号码绑定")]),t._v(" "),s("li",[t._v("当用户使用手机号码登录时,提前调用 "),s("code",[t._v("wx.login")]),t._v(" 获取对应 "),s("code",[t._v("code")]),t._v(",换取 "),s("code",[t._v("openid")]),t._v(" 把他与手机号码进行关联")])]),t._v(" "),s("p",[t._v("现在基于上面的代码,采用第二种方案,只需要微调下代码就能解决这个问题。")]),t._v(" "),s("ul",[s("li",[t._v("登录时把 "),s("code",[t._v("wx.login")]),t._v(" 获取 "),s("code",[t._v("code")]),t._v(" 传递给后端")])]),t._v(" "),s("div",{staticClass:"language-vue extra-class"},[s("pre",{pre:!0,attrs:{class:"language-vue"}},[s("code",[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("template")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("button")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("class")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("login-btn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("open-type")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("@getphonenumber")]),s("span",{pre:!0,attrs:{class:"token attr-value"}},[s("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n 手机号码登录\n "),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token script"}},[s("span",{pre:!0,attrs:{class:"token language-javascript"}},[t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setup")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 目前该接口针对非个人开发者,且完成了认证的小程序开放(不包含海外主体)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("getPhoneNumber")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("e")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" errMsg "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" e"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("detail"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("errMsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'getPhoneNumber:ok'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("login")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("errMsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'login:ok'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" data "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("loginByPhone")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("loginCode")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n userStore"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setUserInfo")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("navigateBack")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("e")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" e"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" errMsg"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n getPhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])]),s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token tag"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n")])])]),s("ul",[s("li",[t._v("服务端基于 loginCode 换取 openid")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 基于手机号登录")]),t._v("\nrouter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/loginByPhone'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("try")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 1. 获取 code 和 loginCode")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" loginCode "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("body"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 2. 获取接口调用凭据,理论上这里需要缓存 access_token,避免频繁调用接口")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" access_token "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/cgi-bin/token'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("grant_type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'client_credential'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3. 获取 openid")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" openid "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/sns/jscode2session'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n appid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n secret"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("js_code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" loginCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n grant_type"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 4. 获取手机号")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" phone_info "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("post")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("/wxa/business/getuserphonenumber?access_token=")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("access_token"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n openid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 5. 查找用户是否已经注册")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 5.1 根据 openid 查找用户")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("findOne")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("where")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n openid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 5.2 如果用户已经注册,返回用户信息")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 5.3 如果用户没有注册,创建用户并返回用户信息")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" username "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("randomUserName")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n models"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("user\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("nickname")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" username"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n openid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("avatar")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/uploads/default-avatar.png'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("phone")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" phone_info"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("purePhoneNumber"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("user")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'登录成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("catch")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("json")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'BIZ_ERROR'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("msg")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("errmsg "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("这种方案被视为最佳的解决方案,能够有效解决多账号和绑定手机号码等问题。 实际上,采用哪种方式取决于具体的业务场景,因为在某些情况下,用户可能会担心手机号码泄露而不愿采用这种方式。")]),t._v(" "),s("h4",{attrs:{id:"_1-2-3-注意"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-2-3-注意"}},[t._v("#")]),t._v(" 1.2.3 注意")]),t._v(" "),s("ul",[s("li",[t._v("获取手机号码是需要收费,每次调用需要 "),s("code",[t._v("0.03")]),t._v(" 元。")]),t._v(" "),s("li",[s("code",[t._v("wx.login")]),t._v(" 与 "),s("code",[t._v("getPhoneNumber")]),t._v(" 中获取的 "),s("code",[t._v("code")]),t._v(" 不是同一个")])]),t._v(" "),s("h2",{attrs:{id:"总结"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#总结"}},[t._v("#")]),t._v(" 总结")]),t._v(" "),s("ul",[s("li",[t._v("基于 openid 或 手机号码快捷登录")]),t._v(" "),s("li",[t._v("获取手机号码前置条件")]),t._v(" "),s("li",[t._v("如何解决多账号的问题")]),t._v(" "),s("li",[t._v("讲解前端、后端、微信登录过程中完整交互流程,方便更好去理解小程序登录")])]),t._v(" "),s("p",[s("strong",[t._v("如果您有任何疑问,请随时在评论区留言。")])])])}),[],!1,null,null,null);s.default=p.exports}}]); \ No newline at end of file diff --git a/assets/js/42.bf0c1ab2.js b/assets/js/42.bf0c1ab2.js new file mode 100644 index 0000000..c180b34 --- /dev/null +++ b/assets/js/42.bf0c1ab2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[42],{473:function(t,s,a){t.exports=a.p+"assets/img/1.fd92b8cd.jpeg"},474:function(t,s,a){t.exports=a.p+"assets/img/2.488a3579.jpeg"},517:function(t,s,a){"use strict";a.r(s);var n=a(2),p=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"请求库封装"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#请求库封装"}},[t._v("#")]),t._v(" 请求库封装")]),t._v(" "),s("h2",{attrs:{id:"背景"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#背景"}},[t._v("#")]),t._v(" 背景")]),t._v(" "),s("p",[t._v("在前端开发中,HTTP 请求是与服务器进行数据交互的核心手段。无论是获取数据还是提交数据,前端应用几乎都离不开 HTTP 请求。在 uniapp 中,"),s("code",[t._v("uni.request")]),t._v(" 是官方提供的用于发起 HTTP 请求的基础 API。然而,直接使用 "),s("code",[t._v("uni.request")]),t._v(" 存在一些问题和不足,比如:")]),t._v(" "),s("ol",[s("li",[s("strong",[t._v("代码冗余")]),t._v(":每次发起请求时都需要编写类似的配置代码,导致代码重复。")]),t._v(" "),s("li",[s("strong",[t._v("缺乏统一管理")]),t._v(":没有统一的地方管理请求参数、头信息、错误处理等,使得代码不易维护")])]),t._v(" "),s("h2",{attrs:{id:"意义"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#意义"}},[t._v("#")]),t._v(" 意义")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("简化请求配置")]),t._v(":在每次发起请求时,通常需要配置很多参数,比如 URL、请求头、请求体等。通过封装请求库,可以设置默认的请求参数,简化每次请求的配置操作,减少开发人员的工作量,提高开发效率。")]),t._v(" "),s("li",[s("strong",[t._v("管理请求凭证")]),t._v(":通过封装请求库,可以集中管理凭证,确保每次请求都自动携带正确的凭证。")]),t._v(" "),s("li",[s("strong",[t._v("便于维护和扩展")]),t._v(":封装请求库后,如果需要对请求逻辑进行修改或扩展,只需要在封装库中进行调整,而不需要在项目的各个地方逐一修改。此外,如果需要将请求库更换为其他库(例如 Axios),只需修改封装的请求库部分,而无需改动业务代码。")]),t._v(" "),s("li",[s("strong",[t._v("提高用户体验")]),t._v(":通过统一处理全局请求 "),s("code",[t._v("Loading")]),t._v(" 状态,可以在请求进行中显示加载提示,提升用户体验。")])]),t._v(" "),s("h2",{attrs:{id:"实现思路"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#实现思路"}},[t._v("#")]),t._v(" 实现思路")]),t._v(" "),s("h3",{attrs:{id:"_1-把-uni-request-改为支持-promise-调用方式"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-把-uni-request-改为支持-promise-调用方式"}},[t._v("#")]),t._v(" 1. 把 uni.request 改为支持 Promise 调用方式")]),t._v(" "),s("p",[t._v("将 "),s("code",[t._v("uni.request")]),t._v(" 改为支持 "),s("code",[t._v("Promise")]),t._v(" 调用方式的好处是可以避免回调嵌套问题,并且可以借助 "),s("code",[t._v("async/await")]),t._v(" 实现同步调用。")]),t._v(" "),s("p",[t._v("实现方式大概有如下两种:")]),t._v(" "),s("h4",{attrs:{id:"_1-1-通过-uni-自身提供的方法"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-1-通过-uni-自身提供的方法"}},[t._v("#")]),t._v(" 1.1 通过 uni 自身提供的方法")]),t._v(" "),s("p",[t._v("调用 "),s("code",[t._v("uni.request")]),t._v(" 时,如果不传入 "),s("code",[t._v("success")]),t._v("、"),s("code",[t._v("fail")]),t._v("、"),s("code",[t._v("complete")]),t._v(" 回调函数,"),s("code",[t._v("uni.request")]),t._v(" 的返回值将是一个 "),s("code",[t._v("Promise")]),t._v(" 对象。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// ... 其他配置")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("catch")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("finally")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h4",{attrs:{id:"_1-2-通过-promise-包装"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-2-通过-promise-包装"}},[t._v("#")]),t._v(" 1.2 通过 Promise 包装")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Promise")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("resolve"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" reject")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("resolve")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("error")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("reject")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("error"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("具体采用哪种方式都可以,这里选择第一种。")]),t._v(" "),s("h3",{attrs:{id:"_2-定义默认请求参数"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-定义默认请求参数"}},[t._v("#")]),t._v(" 2. 定义默认请求参数")]),t._v(" "),s("p",[t._v("在请求时,通常需要设置 "),s("code",[t._v("content-type")]),t._v("、"),s("code",[t._v("timeout")]),t._v(" 等信息。这些参数通常不会改变,因此可以设计为默认参数,同时保留外部覆盖默认参数值的能力。")]),t._v(" "),s("h4",{attrs:{id:"_2-1-定义默认参数"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-1-定义默认参数"}},[t._v("#")]),t._v(" 2.1 定义默认参数")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 定义默认参数")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" defaultOptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("timeout")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("15000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("dataType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v("'content-type'")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h4",{attrs:{id:"_2-2-合并外部参数与默认参数"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-2-合并外部参数与默认参数"}},[t._v("#")]),t._v(" 2.2 合并外部参数与默认参数")]),t._v(" "),s("p",[t._v("提供外部覆盖默认参数值的能力")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" defaultConfig "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("timeout")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("15000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("dataType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v("'content-type'")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" wrapRequest "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'GET'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n header "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultConfig"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h3",{attrs:{id:"_3-统一处理请求凭证"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-统一处理请求凭证"}},[t._v("#")]),t._v(" 3. 统一处理请求凭证")]),t._v(" "),s("p",[t._v("在大多数系统中,接口请求通常需要传递用户凭证。通常的做法是在请求的 "),s("code",[t._v("Header")]),t._v(" 中添加 "),s("code",[t._v("Authorization")]),t._v(" 属性。为了简化这个过程,可以通过拦截器来实现。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TOKEN_KEY")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'token'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 处理 token")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("handleToken")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" token "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getStorageSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TOKEN_KEY")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("token"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Authorization "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" token"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("handleToken")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("另外,系统通常会有多个环境。在这种情况下,可以根据不同的环境设置不同的 "),s("code",[t._v("BASE_URL")]),t._v(",这也可以通过拦截器来实现。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("handleURL")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" url "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token regex"}},[s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token regex-source language-regex"}},[t._v("https|http")]),s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("test")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("startsWith")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("handleURL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("如果有其他处理需求,可以直接在这里添加。")]),t._v(" "),s("h3",{attrs:{id:"_4-统一处理公共响应状态码"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_4-统一处理公共响应状态码"}},[t._v("#")]),t._v(" 4. 统一处理公共响应状态码")]),t._v(" "),s("p",[t._v("为了避免在多个地方处理公共的错误逻辑,例如凭证无效时跳转到登录页、移除本地 token 等,我们可以在全局请求响应拦截器中集中处理这些问题。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOGIN_INVALID_CODE_LIST")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'INVALID_TOKEN'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'EXPIRED_TOKEN'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SUCCESS")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'SUCCESS'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" resData "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" message "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("code "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SUCCESS")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 如果响应代码在登录无效代码列表中")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOGIN_INVALID_CODE_LIST")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("includes")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("icon")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'none'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("navigateTo")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/pages/login/login'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 处理其他错误代码")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" Promise"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("reject")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" Promise"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("resolve")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h3",{attrs:{id:"_5-封装公共方法-get、post、del、put"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_5-封装公共方法-get、post、del、put"}},[t._v("#")]),t._v(" 5. 封装公共方法 GET、POST、DEL、PUT")]),t._v(" "),s("p",[t._v("为了进一步简化请求参数,可以提供一系列方法,例如 "),s("code",[t._v("GET")]),t._v("、"),s("code",[t._v("POST")]),t._v("、"),s("code",[t._v("DELETE")]),t._v("、"),s("code",[t._v("PUT")]),t._v("。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("get")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'GET'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("post")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'POST'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("put")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'PUT'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("del")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'DELETE'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("这样做的好处,它消除了每次调用时显式传入 "),s("code",[t._v("HTTP")]),t._v(" 方法的需要,使代码更简洁、更易读。这样做的好处是你在调用这些方法时只需关注请求参数,而不需要重复指定 "),s("code",[t._v("HTTP")]),t._v(" 方法。")]),t._v(" "),s("h3",{attrs:{id:"_6-定义全局请求-loading"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_6-定义全局请求-loading"}},[t._v("#")]),t._v(" 6. 定义全局请求 Loading")]),t._v(" "),s("p",[t._v("在正常情况下,我们的接口通常会很快完成。然而,考虑到不同网络状况下,接口响应速度可能会变慢,从而增加用户的等待时间。为了优化用户体验,我们可以在全局请求中添加 "),s("code",[t._v("Loading")]),t._v(" 提示,这将大大提升用户体验。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("showLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'加载中'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("hideLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("这样每个接口请求时都会触发显示 "),s("code",[t._v("Loading")]),t._v("。考虑到某些接口可能不需要显示 "),s("code",[t._v("Loading")]),t._v(",我们可以允许用户在定义接口时明确控制是否展示 "),s("code",[t._v("Loading")]),t._v("。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("showLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("loading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'加载中'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("hideLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("loading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("loading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" wrapRequest "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'GET'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n header "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n loading "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 默认是展示 loading")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultConfig"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n loading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("为了解决接口请求很快时 "),s("code",[t._v("Loading")]),t._v(" 闪烁的问题,我们可以添加一个延迟参数。如果请求时间超过 "),s("code",[t._v("50ms")]),t._v("(具体阀值可以自己去定义) 才显示 "),s("code",[t._v("Loading")]),t._v(",否则就不展示:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOADING_DELAY")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 50ms 延迟")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" loadingTimer"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("showLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'加载中'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("hideLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("loading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n loadingTimer "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("showLoading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOADING_DELAY")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("clearTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("loadingTimer"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h2",{attrs:{id:"_7-完整代码如下"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_7-完整代码如下"}},[t._v("#")]),t._v(" 7. 完整代码如下")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" defaultOptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("timeout")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("15000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("dataType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v("'content-type'")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TOKEN_KEY")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'token'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOGIN_INVALID_CODE_LIST")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'INVALID_TOKEN'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'EXPIRED_TOKEN'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SUCCESS")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'SUCCESS'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOADING_DELAY")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 50ms 延迟")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" loadingTimer"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("handleURL")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" url "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token regex"}},[s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token regex-source language-regex"}},[t._v("https|http")]),s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("test")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("startsWith")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BASE_URL")]),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("handleToken")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" token "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getStorageSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TOKEN_KEY")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("token"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Authorization "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" token"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("showLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'加载中'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("hideLoading")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("loading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n loadingTimer "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("showLoading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOADING_DELAY")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("handleURL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("handleToken")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" resData "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" message "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("code "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SUCCESS")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 如果响应代码在登录无效代码列表中")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOGIN_INVALID_CODE_LIST")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("includes")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" message"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("icon")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'none'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("navigateTo")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/pages/login/login'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 处理其他错误代码")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" Promise"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("reject")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" Promise"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("resolve")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resData"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("clearTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("loadingTimer"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideLoading")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" wrapRequest "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'GET'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n header "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n loading "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n loading"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("header")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("defaultOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("header"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("get")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'GET'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("post")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'POST'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("put")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'PUT'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("del")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("wrapRequest")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("params"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("method")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'DELETE'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h2",{attrs:{id:"_8-测试"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_8-测试"}},[t._v("#")]),t._v(" 8. 测试")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" get "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@/utils/request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'https://api.aigcway.com/aigc/chat-category/list'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("输出如下:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"code"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"SUCCESS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"message"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"操作成功"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"data"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"总结"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#总结"}},[t._v("#")]),t._v(" 总结")]),t._v(" "),s("p",[t._v("我们完成了一个通用请求库的封装,这基本上可以满足大多数业务需求。在具体请求中,状态码处理可以根据自身业务需求进行调整。")]),t._v(" "),s("p",[t._v("为了掌握上面的内容,需要掌握 "),s("code",[t._v("uni.addInterceptor")]),t._v("、"),s("code",[t._v("uni.request")]),t._v(" 执行的完整流程。以下是整理的不同情况下的流程图,可以参考学习。")]),t._v(" "),s("img",{attrs:{src:a(473)}}),t._v(" "),s("p",[t._v("上面流程图对应示例代码:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor invoke'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor complete'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nuni\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'then'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("catch")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'catch'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("finally")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'finally'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("img",{attrs:{src:a(474)}}),t._v(" "),s("p",[t._v("上面流程图对应示例代码:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addInterceptor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'request'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("invoke")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor invoke'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'interceptor complete'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'fail'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("complete")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'complete'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=p.exports}}]); \ No newline at end of file diff --git a/assets/js/43.17d42864.js b/assets/js/43.17d42864.js new file mode 100644 index 0000000..95f4507 --- /dev/null +++ b/assets/js/43.17d42864.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[43],{458:function(t,e,r){t.exports=r.p+"assets/img/build.dfacbc6c.png"},492:function(t,e,r){"use strict";r.r(e);var i=r(2),n=Object(i.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"android-打包构建"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#android-打包构建"}},[t._v("#")]),t._v(" Android 打包构建")]),t._v(" "),e("p",[t._v("从 HBuilderX 的打包构建可视化界面,来看看我们需要准备哪些东西。")]),t._v(" "),e("img",{attrs:{src:r(458)}}),t._v(" "),e("ul",[e("li",[t._v("Android Package Name (安卓包名): 理解为一个包的唯一标识")]),t._v(" "),e("li",[t._v("keystore (签名)\n"),e("ul",[e("li",[t._v("使用自己生成签名")]),t._v(" "),e("li",[t._v("使用云签名")]),t._v(" "),e("li",[t._v("使用 Test 签名")]),t._v(" "),e("li",[t._v("使用 DCloud 签名")])])]),t._v(" "),e("li",[t._v("Verson (版本): 应用版本号\n"),e("ul",[e("li",[t._v("Release : 线上版本")]),t._v(" "),e("li",[t._v("自定义 : debugger 版本")])])]),t._v(" "),e("li",[t._v("Native Confusion (代码混合)")]),t._v(" "),e("li",[t._v("Ads 广告")]),t._v(" "),e("li",[t._v("Mode (模式)\n"),e("ul",[e("li",[t._v("Common Mode (上传代码和凭证,DCloud 不会遵循承若)")]),t._v(" "),e("li",[t._v("Safe Mode (上传代码和凭证)")])])])]),t._v(" "),e("p",[t._v("签名可以参考上一篇 "),e("RouterLink",{attrs:{to:"/uniapp/keystore.html"}},[t._v("keystore")])],1),t._v(" "),e("h2",{attrs:{id:"参考"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参考"}},[t._v("#")]),t._v(" 参考")]),t._v(" "),e("p",[e("a",{attrs:{href:"https://blog.csdn.net/ygzrsno/article/details/118327722",target:"_blank",rel:"noopener noreferrer"}},[t._v("uni-app打包成Android Apk详细介绍"),e("OutboundLink")],1)])])}),[],!1,null,null,null);e.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/44.f302e414.js b/assets/js/44.f302e414.js new file mode 100644 index 0000000..eefb0f4 --- /dev/null +++ b/assets/js/44.f302e414.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[44],{461:function(t,s,a){t.exports=a.p+"assets/img/package-error-01.4dfc3791.png"},499:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"常见问题"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#常见问题"}},[t._v("#")]),t._v(" 常见问题")]),t._v(" "),s("h2",{attrs:{id:"小程序"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#小程序"}},[t._v("#")]),t._v(" 小程序")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://developers.weixin.qq.com/community/develop/article/doc/000882df8440404880b91054756c13",target:"_blank",rel:"noopener noreferrer"}},[t._v("关于小程序扫描二维码跳转到体验版的尝试与成果"),s("OutboundLink")],1)])]),t._v(" "),s("p",[t._v("通常小程序码由后台生成后,外部通过扫码进入小程序。 扫码直接跳转的是 "),s("code",[t._v("Release")]),t._v(" 版本。")]),t._v(" "),s("p",[t._v("那有时想调试本地下小程序码生成的内容,显然通过 debugger 版本是做不到的, 假设获取对应页面信息,有办法可以做到呢? 通过 "),s("code",[t._v("wx.scanCode")]),t._v(" 或 "),s("code",[t._v("uni.scanCode")]),t._v(" 功能。")]),t._v(" "),s("p",[t._v("代码如下:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("scanCode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'条码类型:'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scanType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'条码内容:'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("如何打开线上版本小程序的调试模式")])]),t._v(" "),s("p",[t._v("生产版本的小程序如果出现问题,可以调试一下正式版看看,调试方式如下")]),t._v(" "),s("p",[t._v("方式一: https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 打开调试")]),t._v("\nwx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setEnableDebug")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("enableDebug")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 关闭调试")]),t._v("\nwx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setEnableDebug")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("enableDebug")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("false")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n")])])]),s("p",[t._v("方式二: 先在开发版或体验版打开调试,再切到正式版就能看到vConsole")]),t._v(" "),s("h2",{attrs:{id:"app"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#app"}},[t._v("#")]),t._v(" APP")]),t._v(" "),s("h3",{attrs:{id:"_1-android-部分机型中-经常会出现虚拟菜单-虚拟菜单某些情况下会遮住功能菜单"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-android-部分机型中-经常会出现虚拟菜单-虚拟菜单某些情况下会遮住功能菜单"}},[t._v("#")]),t._v(" 1. Android 部分机型中,经常会出现虚拟菜单,虚拟菜单某些情况下会遮住功能菜单")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 利用 5+ 能力,隐藏具体虚拟菜单")]),t._v("\nplus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("navigator"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("hideSystemNavigation")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h3",{attrs:{id:"_2-webview全屏遮挡住状态栏的解决方案"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-webview全屏遮挡住状态栏的解决方案"}},[t._v("#")]),t._v(" 2. webview全屏遮挡住状态栏的解决方案")]),t._v(" "),s("p",[s("a",{attrs:{href:"https://blog.csdn.net/weixin_45360473/article/details/115006620",target:"_blank",rel:"noopener noreferrer"}},[t._v("webview全屏遮挡住状态栏的解决方案"),s("OutboundLink")],1)]),t._v(" "),s("h3",{attrs:{id:"_3-打包后关闭手机的旋转"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-打包后关闭手机的旋转"}},[t._v("#")]),t._v(" 3. 打包后关闭手机的旋转")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// #ifdef APP-PLUS")]),t._v("\n plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("screen"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("lockOrientation")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'portrait-primary'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// #endif")]),t._v("\n")])])]),s("ul",[s("li",[t._v("unlockOrientation()方法恢复到应用的默认值。")])]),t._v(" "),s("p",[t._v("参数:")]),t._v(" "),s("ul",[s("li",[t._v("orientation: ( String ) 必选 要锁定的屏幕方向值")])]),t._v(" "),s("p",[t._v("锁定屏幕方向可取以下值:")]),t._v(" "),s("ul",[s("li",[t._v("“portrait-primary”: 竖屏正方向;")]),t._v(" "),s("li",[t._v("“portrait-secondary”: 竖屏反方向,屏幕正方向按顺时针旋转180°;")]),t._v(" "),s("li",[t._v("“landscape-primary”: 横屏正方向,屏幕正方向按顺时针旋转90°;")]),t._v(" "),s("li",[t._v("“landscape-secondary”: 横屏方向,屏幕正方向按顺时针旋转270°;")]),t._v(" "),s("li",[t._v("“portrait”: 竖屏正方向或反方向,根据设备重力感应器自动调整;")]),t._v(" "),s("li",[t._v("“landscape”: 横屏正方向或反方向,根据设备重力感应器自动调整;")])]),t._v(" "),s("h3",{attrs:{id:"_4-打包时提示这个错误"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_4-打包时提示这个错误"}},[t._v("#")]),t._v(" 4. 打包时提示这个错误")]),t._v(" "),s("img",{attrs:{src:a(461)}}),t._v(" "),s("p",[t._v("在进行云打包时,此 "),s("code",[t._v("APP")]),t._v(" 包使用 "),s("code",[t._v("address book permission")]),t._v(",当前打包账号没有进行实名认证。")]),t._v(" "),s("p",[t._v("解决该问题的两种方式:")]),t._v(" "),s("ul",[s("li",[t._v("前往 "),s("a",{attrs:{href:"https://dev.dcloud.net.cn",target:"_blank",rel:"noopener noreferrer"}},[t._v("开发中心"),s("OutboundLink")],1),t._v(" 完成实名认证。")]),t._v(" "),s("li",[t._v("在 "),s("code",[t._v("manifest.json")]),t._v(" ,可视化视图中,不勾选 "),s("code",[t._v("android.permission.READ_CONTACTS")]),t._v("。")])]),t._v(" "),s("h3",{attrs:{id:"_5-vuecli-创建的项目安装了-node-sass-后在hbuilderx中无法运行"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_5-vuecli-创建的项目安装了-node-sass-后在hbuilderx中无法运行"}},[t._v("#")]),t._v(" 5. VueCli 创建的项目安装了 node-sass 后在HBuilderX中无法运行")]),t._v(" "),s("blockquote",[s("p",[t._v("Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x\nFound bindings for the following environments:")]),t._v(" "),s("ul",[s("li",[t._v("OS X 64-bit with Node.js 14.x")])])]),t._v(" "),s("p",[t._v("造成这个原因主要原因,"),s("code",[t._v("HbuilderX")]),t._v(" 中默认包含一个 "),s("code",[t._v("node")]),t._v(" 版本, "),s("code",[t._v("node-sass")]),t._v(" 与 "),s("code",[t._v("node")]),t._v(" 版本有对应关系,也就不同 "),s("code",[t._v("node-sass")]),t._v(" 版本依赖不同的 "),s("code",[t._v("node")]),t._v(" 版本。")]),t._v(" "),s("p",[t._v("解决这个方式有两种:")]),t._v(" "),s("ul",[s("li",[s("ol",[s("li",[t._v("降低项目中 node-sass 版本。\n"),s("code",[t._v("node-sass")]),t._v(" 与 "),s("code",[t._v("node")]),t._v(" 对应关系,可以查看这里 "),s("a",{attrs:{href:"https://www.npmjs.com/package/node-sass",target:"_blank",rel:"noopener noreferrer"}},[t._v("node-sass"),s("OutboundLink")],1)])])]),t._v(" "),s("li",[s("ol",{attrs:{start:"2"}},[s("li",[t._v("更改 HBuilderX 中 node 版本。")])])])]),t._v(" "),s("div",{staticClass:"language-shell extra-class"},[s("pre",{pre:!0,attrs:{class:"language-shell"}},[s("code",[t._v("// 进入 HBuilderX 插件目录\n$ "),s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" /Applications/HBuilderX.app/Contents/HBuilderX/plugins/node\n// 重新命名,备份一下 "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("node")]),t._v(" 版本\n$ "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("mv")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("node")]),t._v(" node-v12\n\n// 软链接\n$ "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("ln")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token parameter variable"}},[t._v("-s")]),t._v(" /usr/local/bin/node /Applications/HBuilderX.app/Contents/HBuilderX/plugins/node/node\n")])])]),s("p",[s("strong",[t._v("注意")])]),t._v(" "),s("blockquote",[s("p",[s("code",[t._v("/usr/local/bin/node")]),t._v(" 是本地 node 安装路径,有的可能通过 nvm 安装目录地址不一样,需要您根据实际情况调整。\n"),s("code",[t._v("/Applications/HBuilderX.app/Contents/HBuilderX/plugins/node/node")]),t._v(" 是 HBuilderX 内部 node 版本的位置。")])]),t._v(" "),s("h2",{attrs:{id:"h5"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#h5"}},[t._v("#")]),t._v(" H5")]),t._v(" "),s("h2",{attrs:{id:"java"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#java"}},[t._v("#")]),t._v(" Java")]),t._v(" "),s("ul",[s("li",[t._v("查看 Java 目录,查看 keytools")])]),t._v(" "),s("div",{staticClass:"language-shell extra-class"},[s("pre",{pre:!0,attrs:{class:"language-shell"}},[s("code",[t._v("/usr/libexec/java_home "),s("span",{pre:!0,attrs:{class:"token parameter variable"}},[t._v("-V")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/45.053995c1.js b/assets/js/45.053995c1.js new file mode 100644 index 0000000..8c37a4d --- /dev/null +++ b/assets/js/45.053995c1.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[45],{468:function(t,s,a){t.exports=a.p+"assets/img/UrlSchemes.8d865eed.png"},512:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"h5-打开-app-并跳转具体页面"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#h5-打开-app-并跳转具体页面"}},[t._v("#")]),t._v(" H5 打开 APP 并跳转具体页面")]),t._v(" "),s("p",[t._v("要想打开一个 APP 并跳转具体页面 ,大概准备如下:")]),t._v(" "),s("ul",[s("li",[t._v("配置 APP 的 URL Scheme")]),t._v(" "),s("li",[t._v("H5 与 APP 约定参数传递方式,APP 侧在应用的入口根据参数格式解析参数")]),t._v(" "),s("li",[t._v("APP 根据参数跳转到相应的页面")])]),t._v(" "),s("h2",{attrs:{id:"配置-url-scheme"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#配置-url-scheme"}},[t._v("#")]),t._v(" 配置 URL Scheme")]),t._v(" "),s("p",[t._v("打开 "),s("code",[t._v("manifest.json")]),t._v(" ,找到 "),s("code",[t._v("APP常用其它配置选项")]),t._v(", 找到对应的 "),s("code",[t._v("UrlSchemes")]),t._v("。")]),t._v(" "),s("img",{attrs:{src:a(468)}}),t._v(" "),s("p",[t._v("从 "),s("code",[t._v("UrlSchemes")]),t._v(" 可以知道,它支持为应用配置多个 Scheme 。")]),t._v(" "),s("h2",{attrs:{id:"应用解析参数"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#应用解析参数"}},[t._v("#")]),t._v(" 应用解析参数")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// App.vue")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/**\n\t* 解析启动参数\n\t* 约定参数格式\n\t* runtest://?page=qsdetail&questionId=${this.questionId}\n\t*/")]),t._v("\n\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("parseLaunchParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//#ifdef APP-PLUS")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// IOS 需要添加延迟,否则 plus.runtime.arguments 永远访问到的是上一次值。")]),t._v("\n\t\t\t"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" regx "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token regex"}},[s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token regex-source language-regex"}},[t._v("^runtest:\\/\\/\\?")]),s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&&")]),t._v(" regx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("test")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" queryString "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("split")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("regx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" qs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("parse")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queryString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 根据页面参数跳转到不同的页面。")]),t._v("\n\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("page "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'qsdetail'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t\t\t\trouter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("push")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'qsdetail'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("params")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("id")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("questionId\n\t\t\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\t\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("500")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\t\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 这里清空目的,防止参数多次服用。")]),t._v("\n\t\t\t\t\tplus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t\t\tplus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\t\t\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\t\t"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//#endif")]),t._v("\n\t"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onShow")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//#ifdef APP-PLUS")]),t._v("\n\t\t\t\t"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("parseLaunchParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\t\t\t"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//#endif")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"h5-跳转"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#h5-跳转"}},[t._v("#")]),t._v(" H5 跳转")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("a href"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"runtest://?page=qsdetail"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("openApp"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n")])])]),s("h2",{attrs:{id:"在未安装应用时跳转到下载页"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#在未安装应用时跳转到下载页"}},[t._v("#")]),t._v(" 在未安装应用时跳转到下载页")]),t._v(" "),s("p",[t._v("理想情况用户都安装 APP,在很多时候我们并不知道用户是否已经安装某个应用,当未成功跳转时,则跳转至下载页面。")]),t._v(" "),s("p",[t._v("针对上面的方式做下调整,把跳转逻辑换成事件处理的方式。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// app 下载器")]),t._v("\n\t"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" appDownload"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 通用协议地址")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" commSchemeUrl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"runtest://?page=qsdetail"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// iOS 下载地址")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" iOSDownloadUrl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"https://itunes.apple.com/cn/app/"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Android 下载地址")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" androidDownloadUrl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Android 下载地址"')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("openApp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" u "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" navigator"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("userAgent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" isAndroid "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" u"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("indexOf")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Android'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" u"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("indexOf")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Adr'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//判断是否是 android终端")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" isIOS "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("u"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("match")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token regex"}},[s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token regex-source language-regex"}},[t._v("\\(i[^;]+;( U;)? CPU.+Mac OS X")]),s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//判断是否是 iOS终端")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 首次尝试打开 App 并跳转")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("isAndroid "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" isIOS"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("href "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" commSchemeUrl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 3ms 后没打开,直接跳转对应下载页面")]),t._v("\n appDownload "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("isAndroid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("href "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" androidDownloadUrl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("isIOS"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("href "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" iOSDownloadUrl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n document"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addEventListener")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'visibilitychange webkitvisibilitychange'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 如果页面隐藏,认为打开 app,清除下载任务")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("document"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("hidden "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" document"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("webkitHidden"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("clearTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("appDownload"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addEventListener")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'pagehide'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("clearTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("appDownload"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"问题"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#问题"}},[t._v("#")]),t._v(" 问题")]),t._v(" "),s("ul",[s("li",[t._v("IOS 下 "),s("code",[t._v("plus.runtime.arguments")]),t._v(" 不能获取到 URL Scheme 协议参数")])]),t._v(" "),s("blockquote",[s("p",[t._v("检查 pages.json 中是不是有 condition 这个节点(非常重要)")])]),t._v(" "),s("ul",[s("li",[t._v("IOS 下 "),s("code",[t._v("plus.runtime.arguments")]),t._v(" 获取到的都是上一次的值")])]),t._v(" "),s("blockquote",[s("p",[t._v("需要通过 setTimeout 来解决,代码如下")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onShow")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setTimeout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("arguments"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("runtime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("launcher"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"参考文档"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#参考文档"}},[t._v("#")]),t._v(" 参考文档")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://www.html5plus.org/doc/zh_cn/runtime.html#plus.runtime.arguments",target:"_blank",rel:"noopener noreferrer"}},[t._v("plus.runtime.arguments"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://ask.dcloud.net.cn/article/id-64__page-2",target:"_blank",rel:"noopener noreferrer"}},[t._v("iOS 平台设置 UrlSchemes,实现被第三方应用调用"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://ask.dcloud.net.cn/article/409",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android平台设置UrlSchemes,实现被第三方应用调用"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://ask.dcloud.net.cn/question/95040",target:"_blank",rel:"noopener noreferrer"}},[t._v("IOS下plus.runtime.arguments不能获取到URL Scheme协议参数"),s("OutboundLink")],1)])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/46.cd0ff202.js b/assets/js/46.cd0ff202.js new file mode 100644 index 0000000..0a1e34a --- /dev/null +++ b/assets/js/46.cd0ff202.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[46],{469:function(t,s,a){t.exports=a.p+"assets/img/api-login.2fcc9f35.jpg"},513:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"静默获取-openid"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#静默获取-openid"}},[t._v("#")]),t._v(" 静默获取 openId")]),t._v(" "),s("h2",{attrs:{id:"openid-是什么"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#openid-是什么"}},[t._v("#")]),t._v(" openId 是什么?")]),t._v(" "),s("p",[t._v("用户在当前小程序的唯一标识(openid)。")]),t._v(" "),s("h2",{attrs:{id:"小程序中如何获取-openid"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#小程序中如何获取-openid"}},[t._v("#")]),t._v(" 小程序中如何获取 openId")]),t._v(" "),s("img",{attrs:{src:a(469)}}),t._v(" "),s("p",[t._v("小程序端伪代码如下:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("wx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("login")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("code"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n wx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"https://example.com/api/login"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("data")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("code")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("code\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 存储自定义的登录状态;例如 token")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"说明"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#说明"}},[t._v("#")]),t._v(" 说明")]),t._v(" "),s("ul",[s("li",[t._v("调用 "),s("a",{attrs:{href:"https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("wx.login()"),s("OutboundLink")],1),t._v(" 获取 临时登录凭证code ,并回传到开发者服务器。")]),t._v(" "),s("li",[t._v("调用 "),s("a",{attrs:{href:"https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("auth.code2Session"),s("OutboundLink")],1),t._v(" 接口,换取 用户唯一标识 OpenID 、 用户在微信开放平台帐号下的唯一标识UnionID(若当前小程序已绑定到微信开放平台帐号) 和 会话密钥 session_key。")])]),t._v(" "),s("h2",{attrs:{id:"注意事项"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#注意事项"}},[t._v("#")]),t._v(" 注意事项")]),t._v(" "),s("ul",[s("li",[t._v("会话密钥 "),s("code",[t._v("session_key")]),t._v(" 是对用户数据进行 "),s("a",{attrs:{href:"https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("加密签名"),s("OutboundLink")],1),t._v(" 的密钥。为了应用自身的数据安全,开发者服务器"),s("strong",[t._v("不应该把会话密钥下发到小程序,也不应该对外提供这个密钥")]),t._v("。")]),t._v(" "),s("li",[t._v("临时登录凭证 "),s("code",[t._v("code")]),t._v(" 只能使用一次")])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/47.069841fa.js b/assets/js/47.069841fa.js new file mode 100644 index 0000000..736d867 --- /dev/null +++ b/assets/js/47.069841fa.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[47],{480:function(s,t,a){"use strict";a.r(t);var e=a(0),i=Object(e.c)({setup(s,t){const a=document.createElement("script");a.src="http://f1.webshare.mob.com/code/mob-share.js?appkey=2d1a37832f835",a.id="-mob-share",document.body.append(a)}}),o=a(2),c=Object(o.a)(i,(function(){this._self._c,this._self._setupProxy;return this._m(0)}),[function(){var s=this,t=s._self._c;s._self._setupProxy;return t("div",[t("div",{staticClass:"-mob-share-ui-button -mob-share-open"},[s._v("分享")]),s._v(" "),t("div",{staticClass:"-mob-share-ui",staticStyle:{display:"none"}},[t("ul",{staticClass:"-mob-share-list"},[t("li",{staticClass:"-mob-share-weibo"},[t("p",[s._v("新浪微博")])]),s._v(" "),t("li",{staticClass:"-mob-share-qzone"},[t("p",[s._v("QQ空间")])]),s._v(" "),t("li",{staticClass:"-mob-share-qq"},[t("p",[s._v("QQ好友")])]),s._v(" "),t("li",{staticClass:"-mob-share-douban"},[t("p",[s._v("豆瓣")])]),s._v(" "),t("li",{staticClass:"-mob-share-facebook"},[t("p",[s._v("Facebook")])]),s._v(" "),t("li",{staticClass:"-mob-share-twitter"},[t("p",[s._v("Twitter")])])]),s._v(" "),t("div",{staticClass:"-mob-share-close"},[s._v("取消")])]),s._v(" "),t("div",{staticClass:"-mob-share-ui-bg"})])}],!1,null,null,null);t.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/48.80bd15d9.js b/assets/js/48.80bd15d9.js new file mode 100644 index 0000000..2106030 --- /dev/null +++ b/assets/js/48.80bd15d9.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[48],{488:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("记录开发中点点滴滴")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/49.344ee38d.js b/assets/js/49.344ee38d.js new file mode 100644 index 0000000..8f1571a --- /dev/null +++ b/assets/js/49.344ee38d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[49],{490:function(t,s,r){"use strict";r.r(s);var e=r(2),n=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"flutter"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#flutter"}},[this._v("#")]),this._v(" Flutter")])])}),[],!1,null,null,null);s.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/5.c4d85495.js b/assets/js/5.c4d85495.js new file mode 100644 index 0000000..d7dfd86 --- /dev/null +++ b/assets/js/5.c4d85495.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{349:function(t,e,a){},351:function(t,e,a){},352:function(t,e,a){"use strict";a(349)},353:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(344),o=Object(r.c)({components:{RecoIcon:n.b},props:{pageInfo:{type:Object,default:()=>({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const a=Object(s.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{a.$route.path!==`/tag/${t}/`&&a.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(a.$lang).format(new Date(t))}}}),c=(a(352),a(2)),i=Object(c.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(a,r){return e("span",{key:r,staticClass:"tag-item",class:{active:t.currentTag==a},on:{click:function(e){return e.stopPropagation(),t.goTags(a)}}},[t._v(t._s(a))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},354:function(t,e,a){},355:function(t,e,a){},362:function(t,e,a){"use strict";a(351)},363:function(t,e,a){},364:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(353),o=Object(r.c)({components:{PageInfo:s.default,RecoIcon:n.b},props:["item","currentPage","currentTag"]}),c=(a(362),a(2)),i=Object(c.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports},365:function(t,e,a){"use strict";a(354)},366:function(t,e,a){"use strict";a(355)},371:function(t,e,a){},372:function(t,e,a){"use strict";a.r(e);var r=a(0),n={methods:{_getStoragePage(){const t=window.location.pathname,e=JSON.parse(sessionStorage.getItem("currentPage"));return null===e||t!==e.path?(sessionStorage.setItem("currentPage",JSON.stringify({page:1,path:""})),1):parseInt(e.page)},_setStoragePage(t){const e=window.location.pathname;sessionStorage.setItem("currentPage",JSON.stringify({page:t,path:e}))}}},s=a(364),o=a(344),c=Object(r.c)({mixins:[n],components:{NoteAbstractItem:s.default},props:["data","currentTag"],setup(t,e){const a=Object(o.a)(),{data:n}=Object(r.i)(t),s=Object(r.h)(1),c=Object(r.a)(()=>{const t=(s.value-1)*a.$perPage,e=s.value*a.$perPage;return n.value.slice(t,e)});return Object(r.e)(()=>{s.value=a._getStoragePage()||1}),{currentPage:s,currentPageData:c,getCurrentPage:t=>{s.value=t,a._setStoragePage(t),e.emit("paginationChange",t)}}},watch:{$route(){this.currentPage=this._getStoragePage()||1}}}),i=(a(365),a(2)),u=Object(i.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-wrapper"},[t._l(t.currentPageData,(function(a){return e("NoteAbstractItem",{key:a.path,attrs:{item:a,currentPage:t.currentPage,currentTag:t.currentTag}})})),t._v(" "),e("pagation",{staticClass:"pagation",attrs:{total:t.data.length,currentPage:t.currentPage},on:{getCurrentPage:t.getCurrentPage}})],2)}),[],!1,null,"21a20f36",null);e.default=u.exports},378:function(t,e,a){"use strict";a(363)},382:function(t,e,a){"use strict";a.r(e);var r=a(0),n=a(43),s=a(344),o=Object(r.c)({props:{currentTag:{type:String,default:""}},setup(t,e){const a=Object(s.a)();return{tags:Object(r.a)(()=>[{name:a.$recoLocales.all,path:"/tag/"},...a.$tagesList]),tagClick:t=>{e.emit("getCurrentTag",t)},getOneColor:n.b}}}),c=(a(378),a(2)),i=Object(c.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"tags"},t._l(t.tags,(function(a,r){return e("span",{directives:[{name:"show",rawName:"v-show",value:!a.pages||a.pages&&a.pages.length>0,expression:"!item.pages || (item.pages && item.pages.length > 0)"}],key:r,class:{active:a.name==t.currentTag},style:{backgroundColor:t.getOneColor()},on:{click:function(e){return t.tagClick(a)}}},[t._v(t._s(a.name))])})),0)}),[],!1,null,"cbf58c6c",null);e.default=i.exports},398:function(t,e,a){"use strict";a(371)},427:function(t,e,a){},456:function(t,e,a){"use strict";a(427)},485:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(399),s=a(382),o=a(372),c=a(344),i=Object(r.c)({components:{Common:n.default,NoteAbstract:o.default,TagList:s.default},setup(t,e){const a=Object(c.a)();return{tagClick:t=>{a.$route.path!==t.path&&a.$router.push({path:t.path})},paginationChange:t=>{setTimeout(()=>{window.scrollTo(0,0)},100)}}}}),u=(a(366),a(398),a(456),a(2)),g=Object(u.a)(i,(function(){var t=this._self._c;this._self._setupProxy;return t("Common",{staticClass:"tags-wrapper",attrs:{sidebar:!1}},[t("TagList",{attrs:{currentTag:this.$recoLocales.all},on:{getCurrentTag:this.tagClick}}),this._v(" "),t("note-abstract",{staticClass:"list",attrs:{data:this.$recoPosts},on:{paginationChange:this.paginationChange}})],1)}),[],!1,null,"76b3aa19",null);e.default=g.exports}}]); \ No newline at end of file diff --git a/assets/js/50.6d03d100.js b/assets/js/50.6d03d100.js new file mode 100644 index 0000000..6678b3f --- /dev/null +++ b/assets/js/50.6d03d100.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[50],{489:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("nodejs")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/51.df88714d.js b/assets/js/51.df88714d.js new file mode 100644 index 0000000..2042f3f --- /dev/null +++ b/assets/js/51.df88714d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{491:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("Nuxt")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/52.2275a23f.js b/assets/js/52.2275a23f.js new file mode 100644 index 0000000..52afbef --- /dev/null +++ b/assets/js/52.2275a23f.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[52],{493:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("Nuxt")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/53.396ecb65.js b/assets/js/53.396ecb65.js new file mode 100644 index 0000000..ccc8e5a --- /dev/null +++ b/assets/js/53.396ecb65.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[53],{495:function(t,s,a){"use strict";a.r(s);var n=a(2),p=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"保存图片到相册"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#保存图片到相册"}},[t._v("#")]),t._v(" 保存图片到相册")]),t._v(" "),s("h2",{attrs:{id:"app"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#app"}},[t._v("#")]),t._v(" APP")]),t._v(" "),s("p",[t._v("通常图片的来源分为"),s("code",[t._v("网络图片")]),t._v(","),s("code",[t._v("本地图片(相册、相机)")]),t._v(","),s("code",[t._v("Base64")]),t._v("。 不同的来源,图片保存有一定的差异性。 下面分别针对不同来源,实现图片保存操作。")]),t._v(" "),s("ul",[s("li",[t._v("网络图片")])]),t._v(" "),s("p",[t._v("在 app 实现保存网络图片到相册,这个功能还是比较简单的,只需要使用 "),s("code",[t._v("uni.downloadFile")]),t._v(" 和 "),s("code",[t._v("uni.saveImageToPhotosAlbum")]),t._v(" 两个 API 即可。前者用来下载网络图片到本地,获取临时路径。 后者基于临时路径进行保存到相册操作。")]),t._v(" "),s("p",[t._v("具体代码实现:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("downloadFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'https://www.example.com/file/test'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("statusCode "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("200")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'save success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("本地图片(相册、相机)")])]),t._v(" "),s("p",[t._v("需要访问用户相册、相机,在使用时需要获取系统访问权限。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("chooseImage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("count")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("sourceType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'camera'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//支持 'camera', 'album' ,在不指定 sourceType 时,默认情况下支持两种方式")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePaths"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'save success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("基于 base64")])]),t._v(" "),s("p",[t._v("通常出现 "),s("code",[t._v("base64")]),t._v(" 编码格式的图片情况,通常出现在营销活动宣传海报的。比如基于 "),s("code",[t._v("canvas")]),t._v(" 绘制课程海报,活动推广等。")]),t._v(" "),s("p",[t._v("接下来现分析具体的实现思路:")]),t._v(" "),s("p",[t._v("从 "),s("code",[t._v("uni.saveImageToPhotosAlbum")]),t._v(" 方法入手,它接收参数为 "),s("code",[t._v("临时路径")]),t._v(" 或 "),s("code",[t._v("永久路径")]),t._v(" (不支持网络图片)。 意味着,只需要想办法把 "),s("code",[t._v("base64")]),t._v(" 编码格式图片转成本地文件,获取其临时文件路径即可。")]),t._v(" "),s("p",[t._v("思路有了,那么在 "),s("code",[t._v("uniapp")]),t._v(" 中有提供这样的支持 ? 有,可以利用 "),s("code",[t._v("Bitmap(位图)")])]),t._v(" "),s("p",[t._v("Bitmap 是什么?")]),t._v(" "),s("blockquote",[s("p",[t._v("即位图。它本质上就是一张图片的内容在内存中的表达形式")])]),t._v(" "),s("p",[t._v("这里不详细展开,具体可以通过查阅资料了解更多关于 "),s("code",[t._v("Bitmap")]),t._v(" 的知识。")]),t._v(" "),s("p",[t._v("如何去构建对应的 "),s("code",[t._v("Bitmap")]),t._v(" 对象? 在 "),s("code",[t._v("uniapp")]),t._v(" 中,可以通过 "),s("code",[t._v("plus+")]),t._v(" 中提供 "),s("code",[t._v("plus.nativeObj.Bitmap")]),t._v(" 构建位图对象。")]),t._v(" "),s("p",[t._v("下面具体的实现:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nativeObj"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Bitmap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'bitmap'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" base64 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 加载 Base64 编码格式图片到 Bitmap 对象")]),t._v("\nbitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("loadBase64Data")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("base64"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 指定存储临时目录")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" url "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token template-string"}},[s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("_doc/")]),s("span",{pre:!0,attrs:{class:"token interpolation"}},[s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("${")]),t._v("Date"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("now")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token interpolation-punctuation punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v(".png")]),s("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 保存图片")]),t._v("\n bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("save")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("overwrite")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("i")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 保存图片到相册")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("target"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'save success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showToast")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存图片失败'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("关于 "),s("code",[t._v("plus.nativeObj.Bitmap")]),t._v(" 详细介绍,可以参考"),s("a",{attrs:{href:"https://www.shouce.ren/api/html5plus/doc/nativeobj.html#plus.nativeObj.Bitmap",target:"_blank",rel:"noopener noreferrer"}},[t._v("这里"),s("OutboundLink")],1),t._v(".")])])}),[],!1,null,null,null);s.default=p.exports}}]); \ No newline at end of file diff --git a/assets/js/54.3fb65b61.js b/assets/js/54.3fb65b61.js new file mode 100644 index 0000000..140bff7 --- /dev/null +++ b/assets/js/54.3fb65b61.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[54],{496:function(e,a,t){"use strict";t.r(a);var s=t(2),r=Object(s.a)({},(function(){var e=this,a=e._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[a("h1",{attrs:{id:"快速上手"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#快速上手"}},[e._v("#")]),e._v(" 快速上手")]),e._v(" "),a("p",[e._v("Uniapp 官方提供两种创建项目的方式:")]),e._v(" "),a("ul",[a("li",[e._v("HBuilderX 开发者工具")]),e._v(" "),a("li",[e._v("vue-cli 命令行工具")])]),e._v(" "),a("p",[e._v("具体两者创建的区别,大家可以查阅 "),a("code",[e._v("Uniapp")]),e._v(" 官方的介绍 "),a("a",{attrs:{href:"https://uniapp.dcloud.io/quickstart-cli.html#%E4%BD%BF%E7%94%A8cli%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE%E5%92%8C%E4%BD%BF%E7%94%A8hbuilderx%E5%8F%AF%E8%A7%86%E5%8C%96%E7%95%8C%E9%9D%A2%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB",target:"_blank",rel:"noopener noreferrer"}},[e._v("cli创建项目和使用HBuilderX可视化界面创建项目有什么区别\n#"),a("OutboundLink")],1),e._v("。")]),e._v(" "),a("p",[e._v("通过 "),a("code",[e._v("vue-cli")]),e._v(" 创建的项目模版,更接近平常开发 Vue 项目结构,这样能够减少熟悉的成本。")]),e._v(" "),a("p",[e._v("下面通过 "),a("code",[e._v("vue-cli")]),e._v(" 来创建项目模版。")]),e._v(" "),a("h2",{attrs:{id:"步骤如下"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#步骤如下"}},[e._v("#")]),e._v(" 步骤如下")]),e._v(" "),a("h3",{attrs:{id:"安装-cli"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#安装-cli"}},[e._v("#")]),e._v(" 安装 CLI")]),e._v(" "),a("p",[e._v("假设已经安装的话,可以忽略当前步骤。")]),e._v(" "),a("div",{staticClass:"language-shell extra-class"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[a("span",{pre:!0,attrs:{class:"token function"}},[e._v("npm")]),e._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[e._v("install")]),e._v(" "),a("span",{pre:!0,attrs:{class:"token parameter variable"}},[e._v("-g")]),e._v(" @vue/cli@4\n")])])]),a("h3",{attrs:{id:"创建-uni-app"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#创建-uni-app"}},[e._v("#")]),e._v(" 创建 uni-app")]),e._v(" "),a("ul",[a("li",[e._v("使用正式版(对应HBuilderX最新正式版)")])]),e._v(" "),a("div",{staticClass:"language-shell extra-class"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[e._v("vue create "),a("span",{pre:!0,attrs:{class:"token parameter variable"}},[e._v("-p")]),e._v(" dcloudio/uni-preset-vue my-project\n")])])]),a("ul",[a("li",[e._v("使用alpha版(对应HBuilderX最新alpha版)")])]),e._v(" "),a("div",{staticClass:"language-shell extra-class"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[e._v("vue create "),a("span",{pre:!0,attrs:{class:"token parameter variable"}},[e._v("-p")]),e._v(" dcloudio/uni-preset-vue"),a("span",{pre:!0,attrs:{class:"token comment"}},[e._v("#alpha my-alpha-project")]),e._v("\n")])])]),a("h3",{attrs:{id:"注意事项"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#注意事项"}},[e._v("#")]),e._v(" 注意事项")]),e._v(" "),a("p",[a("code",[e._v("dcloudio/uni-preset-vue")]),e._v(" 是一个预设的模版,它内容是在 Github 上,在安装的时可能会出现查找模版失败的问\n题。")]),e._v(" "),a("div",{staticClass:"language-shell extra-class"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[e._v("ERROR Failed fetching remote preset dcloudio/uni-preset-vue:\nERROR RequestError: "),a("span",{pre:!0,attrs:{class:"token builtin class-name"}},[e._v("read")]),e._v(" ECONNRESET\n")])])]),a("p",[e._v("上面错误是,需要科学上网才能正常访问。")]),e._v(" "),a("p",[e._v("通常可以把 "),a("code",[e._v("dcloudio/uni-preset-vue")]),e._v(" 模版下载下来,然后创建时 "),a("code",[e._v("dcloudio/uni-preset-vue")]),e._v(" 指向本地的模版,如下:")]),e._v(" "),a("div",{staticClass:"language-shell extra-class"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[e._v("vue create "),a("span",{pre:!0,attrs:{class:"token parameter variable"}},[e._v("-p")]),e._v(" ./本地目录/dcloudio/uni-preset-vue my-project\n")])])]),a("h2",{attrs:{id:"使用自定义模版"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#使用自定义模版"}},[e._v("#")]),e._v(" 使用自定义模版")]),e._v(" "),a("p",[a("a",{attrs:{href:"https://github.com/wangjing013/uni-vue-template",target:"_blank",rel:"noopener noreferrer"}},[e._v("uni-vue-template"),a("OutboundLink")],1)]),e._v(" "),a("p",[e._v("上面的模版也是通过 Vue CLI 创建的,只是在它基础上添加一些内容。")]),e._v(" "),a("ul",[a("li",[e._v("常见工具类封装(路由、请求、登录、获取手机号码等等)。")]),e._v(" "),a("li",[e._v("代码检测(ESLint,Git hook,lint-staged) 等等。")])]),e._v(" "),a("p",[e._v("基本可以开箱即用,让我们更加聚焦在业务层面的开发。")])])}),[],!1,null,null,null);a.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/55.0740d5c5.js b/assets/js/55.0740d5c5.js new file mode 100644 index 0000000..1741b36 --- /dev/null +++ b/assets/js/55.0740d5c5.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[55],{494:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){return(0,this._self._c)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/56.58541c66.js b/assets/js/56.58541c66.js new file mode 100644 index 0000000..c5b1135 --- /dev/null +++ b/assets/js/56.58541c66.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[56],{498:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"eventchannel"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#eventchannel"}},[t._v("#")]),t._v(" EventChannel")]),t._v(" "),s("p",[t._v("在本文中,我们将探讨如何在 uniapp 中利用 EventChannel 实现页面之间的高效通信。EventChannel 是 uniapp 提供的一种专门用于页面间通信的机制,特别适合在页面间传递数据或更新状态的场景。")]),t._v(" "),s("h2",{attrs:{id:"实际业务场景"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#实际业务场景"}},[t._v("#")]),t._v(" 实际业务场景")]),t._v(" "),s("p",[t._v("为了更好地理解 EventChannel 的应用,我们来看一个典型的业务场景:假设在一个电商应用中,有一个订单列表,其中某个订单的状态为“待付款”。用户点击该订单,进入订单详情页面。在订单详情页面,用户选择“取消订单”,操作成功后,该订单的状态变为“已取消”。")]),t._v(" "),s("p",[t._v("此时,我们面临一个问题:如何在订单详情页面取消订单后,自动更新订单列表页面中对应订单的状态,使其从“待付款”变为“已取消”。")]),t._v(" "),s("p",[t._v("一种简单直接的解决方案是在订单列表页面中使用 "),s("code",[t._v("onShow")]),t._v(" 生命周期方法,在每次页面重新展示时调用接口重新获取订单列表。然而,这种方法存在以下缺点:")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("资源浪费")]),t._v(":用户每次切换页面都会触发加载操作,导致不必要的网络请求和资源浪费。")]),t._v(" "),s("li",[s("strong",[t._v("用户体验不佳")]),t._v(":如果用户在订单列表中点击的订单位于列表中间或底部,跳转回列表页面后,滚动位置可能会丢失,导致用户体验不佳。")])]),t._v(" "),s("p",[t._v("为了解决这些问题,我们可以采用一种更加无缝和智能的方式,这正是 EventChannel 的用武之地。")]),t._v(" "),s("p",[t._v("EventChannel 可以在两个页面间建立通信通道,当订单详情页面的状态发生变化时,及时通知订单列表页面更新状态,无需额外的页面刷新或滚动位置丢失。此外,EventChannel 也不是唯一的选择。我们还可以通过全局状态管理(如 Paina)、EventBus 等方式来实现类似的效果。")]),t._v(" "),s("p",[t._v("在接下来的部分,我们将详细介绍如何使用 EventChannel 实现这一场景下的页面通信。")]),t._v(" "),s("h2",{attrs:{id:"使用方法"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#使用方法"}},[t._v("#")]),t._v(" 使用方法")]),t._v(" "),s("h3",{attrs:{id:"在订单列表页面监听事件"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#在订单列表页面监听事件"}},[t._v("#")]),t._v(" 在订单列表页面监听事件")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// order.vue")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" orderList "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("ref")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("navigateTo")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/order-detail'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("events")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("orderStatusChange")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" orderId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" status "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 从列单列表中查询对应项")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" index "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" orderList"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("findIndex")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("order")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" order"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("id "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" orderId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("index "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 修改订单状态")]),t._v("\n orderList"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("index"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("status "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("status"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 同样删除也可以")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// orderList.value.splice(index, 1);")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("在跳转到订单详情页面时,通过 "),s("code",[t._v("navigateTo")]),t._v(" 方法传递 "),s("code",[t._v("events")]),t._v(" 属性,用于监听订单状态变化事件。")]),t._v(" "),s("h3",{attrs:{id:"在订单详情页面发送事件"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#在订单详情页面发送事件"}},[t._v("#")]),t._v(" 在订单详情页面发送事件")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// order-detail.vue")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" proxy "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getCurrentInstance")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" eventChannel "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("handleCancel")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 取消订单操作")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// ...")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 执行通信")]),t._v("\n eventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("emit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'orderStatusChange'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("orderId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'1234567'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("status")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'cancel'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("onLoad")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n eventChannel "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" proxy"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getOpenerEventChannel")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("在订单详情页面中,通过 "),s("code",[t._v("getOpenerEventChannel")]),t._v(" 方法获取到打开订单详情页面的 EventChannel 对象,并通过调用 "),s("code",[t._v("emit")]),t._v(" 方法发送消息。")]),t._v(" "),s("h2",{attrs:{id:"eventchannel-是什么"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#eventchannel-是什么"}},[t._v("#")]),t._v(" EventChannel 是什么")]),t._v(" "),s("p",[t._v("事实上,·"),s("code",[t._v("EventChannel")]),t._v(" 的内部实现可以看作是一个自定义事件类,通过事件的发布(emit)和订阅(on)机制,实现页面之间的数据通信。")]),t._v(" "),s("p",[t._v("下面就是具体实现。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("type NavigateToOptionEvents "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Record"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("interface")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("EventChannelListener")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'on'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'once'")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("EventChannel")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" number\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("private")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("listener")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Record"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("private")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("emitCache")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("args")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("eventName")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("constructor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" number"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" events"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" NavigateToOptionEvents")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("id "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" id\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("events"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Object"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("keys")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("events"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("on")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" events"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("emit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("eventName")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" fns "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("push")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("opt")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n opt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("apply")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("opt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("filter")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("opt")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" opt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("type "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'once'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("on")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'fn'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_addListener")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'on'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_clearCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("once")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'fn'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_addListener")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'once'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_clearCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("off")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'fn'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" fns "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fn "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n fns"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("splice")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n i"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n i"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("delete")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_clearCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("eventName"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" index "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" index "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" index"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" cache "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("index"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" _name "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" eventName\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" cache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eventName "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" eventName\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" eventName\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" cache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eventName\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("_name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("continue")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" location "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("emit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("apply")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("_name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("cache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" location "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'number'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("pop")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("continue")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("emitCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("splice")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("index"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n index"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("_addListener")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("eventName")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'type'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("fn")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannelListener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'fn'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("listener"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("eventName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("push")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n fn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n type"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("在了解 "),s("code",[t._v("EventChannel")]),t._v(" 实现之后,接下来看下两个页面是如何共享 "),s("code",[t._v("EventChannel")]),t._v(" 实例的。")]),t._v(" "),s("h2",{attrs:{id:"两个页面是如何共享-eventchannel-实例的"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#两个页面是如何共享-eventchannel-实例的"}},[t._v("#")]),t._v(" 两个页面是如何共享 EventChannel 实例的")]),t._v(" "),s("p",[t._v("页面之间之所以能够实现通信,关键在于它们共享同一个 "),s("code",[t._v("EventChannel")]),t._v(" 实例。同时,新页面能够通过调用 "),s("code",[t._v("getOpenerEventChannel")]),t._v(" 方法获取到这个共享的实例。")]),t._v(" "),s("p",[t._v("要深入理解这一机制,我们需要了解 "),s("code",[t._v("uni.navigateTo")]),t._v(" 方法和 "),s("code",[t._v("getOpenerEventChannel")]),t._v(" 方法各自的工作原理。")]),t._v(" "),s("p",[t._v("接下来看下内部实现:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("navigateTo")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n events"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n aniType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n aniDuration"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" NavigateToOptions")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Promise"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("eventChannel")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannel "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 创建 eventChannel")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" eventChannel "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("EventChannel")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getWebviewId")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" events"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Promise")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("resolve")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("showWebview")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("registerPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("openType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'navigateTo'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" eventChannel "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n aniType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n aniDuration"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("resolve")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" eventChannel "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setStatusBarStyle")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("上面看到把 "),s("code",[t._v("eventChannel")]),t._v(" 传递给了 "),s("code",[t._v("registerPage")]),t._v(" 方法。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// registerPage 方法")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("registerPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n openType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n webview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n nvuePageVm"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n eventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" RegisterPageOptions")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("webview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n webview "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createWebview")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" routeOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n webview "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" plus"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("webview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getWebviewById")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("webview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("webview "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nvue "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" routeOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("meta"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("isNVue\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initWebview")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("webview"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" routeOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("meta"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pageInstance "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initPageInternalInstance")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// ...,")]),t._v("\n eventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createVuePage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" route"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" pageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initPageOptions")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("routeOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" webview\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("在 registerPage 中主要做了几件事:")]),t._v(" "),s("ul",[s("li",[t._v("创建 webview 实例")]),t._v(" "),s("li",[t._v("初始化 webview")]),t._v(" "),s("li",[t._v("初始化页面内部实例")]),t._v(" "),s("li",[t._v("创建 vue 页面")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initPageInternalInstance")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("openType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UniApp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("OpenType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageQuery")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Record"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("meta")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UniApp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageRouteMeta"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n eventChannel"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" EventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n themeMode"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UniApp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("ThemeMode")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'$page'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" route "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" meta\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("id")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("route")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" route"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("fullPath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("options")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" pageQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n meta"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n openType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n eventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("statusBarStyle")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" titleColor "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'#ffffff'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'light'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'dark'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("这方法并没有做太多逻辑处理。 只要记住 "),s("code",[t._v("eventChannel")]),t._v(" 放入内部实例中,接着往下看 "),s("code",[t._v("createVuePage")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" VuePageAsyncComponent "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" VuePageComponent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("isVuePageAsyncComponent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setupPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setupPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pagesMap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Map")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" ReturnType"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" createFactory"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">>")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("definePage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pagePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("asyncComponent")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" VuePageAsyncComponent "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" VuePageComponent")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n pagesMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("set")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("pagePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("once")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("asyncComponent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createVuePage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("__pageId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" number"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("__pagePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("__pageQuery")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Record"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("__pageInstance")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'$page'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageOptions")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" PageNodeOptions\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pageNode "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createPageNode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("__pageId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" pageOptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 获取 Vue 根应用")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" app "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getVueApp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 根据路径获取页面组件")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" component "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" pagesMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("__pagePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 页面挂载")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("mountPage")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" VuePageComponent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v("\n app"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("mountPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("extend")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n __pageId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n __pagePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n __pageQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n __pageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n __pageQuery\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n pageNode\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("isPromise")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("mountPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("mountPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("mountPage")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageComponent")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" VuePageComponent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageProps")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Record"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("string"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageContainer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UniNode")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" vnode "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createVNode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("pageComponent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" pageProps"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// store app context on the root VNode.")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// this will be set on the root instance on initial mount.")]),t._v("\n vnode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("appContext "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" appContext\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("vnode "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("__page_container__ "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" pageContainer\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("render")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("vnode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" pageContainer "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" unknown "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" Element"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" publicThis "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vnode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("component"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("proxy"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("publicThis "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" any"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("__page_container__ "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" pageContainer\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" publicThis\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("在上述代码中,"),s("code",[t._v("__pageInstance")]),t._v(" 被作为 "),s("code",[t._v("pageProps")]),t._v(" 传递给 "),s("code",[t._v("mountPage")]),t._v(" 方法。当执行 "),s("code",[t._v("mountPage")]),t._v(" 后,"),s("code",[t._v("pageProps")]),t._v(" 会被添加到组件的上下文 "),s("code",[t._v("context")]),t._v(" 对象中 "),s("code",[t._v("attrs")]),t._v(" 属性中。")]),t._v(" "),s("p",[t._v("在前面的代码中,虽然没有直接看到对 "),s("code",[t._v("eventChannel")]),t._v(" 对象的使用,但它主要用于参数传递。回顾前面提到的使用方法部分,我们注意到在页面中通过 "),s("code",[t._v("proxy.getOpenerEventChannel()")]),t._v(" 来获取 "),s("code",[t._v("eventChannel")]),t._v(" 实例,也就是说,"),s("code",[t._v("getOpenerEventChannel")]),t._v(" 是在页面实例上添加的。那么,它是何时被添加到实例上的呢? "),s("code",[t._v("setupPage")]),t._v(" 中。")]),t._v(" "),s("p",[s("code",[t._v("setupPage")]),t._v(" 方法代码如下:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setupPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("component")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" VuePageComponent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" oldSetup "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("setup\n component"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("setup")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("props"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" ctx")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("attrs")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" __pageId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" __pagePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*__pageQuery,*/")]),t._v(" __pageInstance "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" ctx\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" instance "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getCurrentInstance")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pageVm "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" instance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("proxy"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initPageVm")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("pageVm"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" __pageInstance "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" Page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'$page'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("pageVm"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("$page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("openType "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'openDialogPage'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addCurrentPage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initScope")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n __pageId "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" number"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n pageVm"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n __pageInstance "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" Page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'$page'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("oldSetup"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("oldSetup")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("props"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" component\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initScope")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" number"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("vm")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ComponentPublicInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("pageInstance")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Page"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'$page'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//")]),t._v("\n vm"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("getOpenerEventChannel")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("pageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eventChannel"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n pageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eventChannel "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("EventChannel")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("pageId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" pageInstance"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eventChannel "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" EventChannel\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" vm\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[s("code",[t._v("setupPage")]),t._v(" 通过重写组件的 "),s("code",[t._v("setup")]),t._v(" 函数,同时保留组件的默认 "),s("code",[t._v("setup")]),t._v(" 功能,这正是面向切面编程的一个典型示例。")]),t._v(" "),s("p",[t._v("在 "),s("code",[t._v("initScope")]),t._v(" 方法中,"),s("code",[t._v("getOpenerEventChannel")]),t._v(" 被添加到了 "),s("code",[t._v("vm")]),t._v(" 实例对象上,这正是我们能够通过 "),s("code",[t._v("proxy")]),t._v(" 访问到 "),s("code",[t._v("getOpenerEventChannel")]),t._v(" 的原因")]),t._v(" "),s("p",[t._v("至此,我们已经基本掌握了 EventChannel 在页面间通信的使用方法及其实现原理。")])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/57.93f5c7c8.js b/assets/js/57.93f5c7c8.js new file mode 100644 index 0000000..bf7749e --- /dev/null +++ b/assets/js/57.93f5c7c8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[57],{503:function(t,s,n){"use strict";n.r(s);var a=n(2),e=Object(a.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"flex-布局"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#flex-布局"}},[t._v("#")]),t._v(" Flex 布局")]),t._v(" "),s("p",[t._v("Flex 在移动端开发中使用最多布局方式和,基本上无需考虑其兼容性。 在编写页面的时,一个好的 CSS 工具可以提升开发效率。")]),t._v(" "),s("p",[t._v("通常使用第三方提供的 flex.css ,提供辅助类帮助快速构建用户界面。")]),t._v(" "),s("div",{staticClass:"language-css extra-class"},[s("pre",{pre:!0,attrs:{class:"language-css"}},[s("code",[t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* ========================================================================\n Component: Flex\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("display")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-inline")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("display")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" inline-flex"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Remove pseudo elements created by micro clearfix as precaution\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex::before,\n .flex::after,\n .flex-inline::before,\n .flex-inline::after")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("display")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" none"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* Alignment\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Align items along the main axis of the current line of the flex container\n * Row: Horizontal\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v("// Default\n .flex-left")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("justify-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-start"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-center")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("justify-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" center"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-right")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("justify-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-end"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-between")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("justify-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" space-between"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-around")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("justify-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" space-around"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Align items in the cross axis of the current line of the flex container\n * Row: Vertical\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v("// Default\n .flex-stretch")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-items")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" stretch"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-top")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-items")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-start"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-middle")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-items")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" center"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-bottom")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-items")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-end"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* Direction\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v("// Default\n .flex-row")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-direction")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" row"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-row-reverse")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-direction")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" row-reverse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-column")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-direction")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" column"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-column-reverse")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-direction")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" column-reverse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* Wrap\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v("// Default\n .flex-nowrap")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-wrap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" nowrap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-wrap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" wrap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-reverse")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex-wrap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" wrap-reverse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Aligns items within the flex container when there is extra space in the cross-axis\n * Only works if there is more than one line of flex items\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v("// Default\n .flex-wrap-stretch")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" stretch"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-top")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-start"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-middle")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" center"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-bottom")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" flex-end"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-between")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" space-between"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-wrap-around")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("align-content")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" space-around"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* Item ordering\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Default is 0\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-first")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("order")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" -1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-last")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("order")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" 99"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* Item dimensions\n ========================================================================== */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Initial: 0 1 auto\n * Content dimensions, but shrinks\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * No Flex: 0 0 auto\n * Content dimensions\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-none")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" none"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Relative Flex: 1 1 auto\n * Space is allocated considering content\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-auto")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" auto"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/*\n * Absolute Flex: 1 1 0%\n * Space is allocated solely based on flex\n */")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token selector"}},[t._v(".flex-1")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v("flex")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" 1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n")])])]),s("h2",{attrs:{id:"可视化-flex-工具"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#可视化-flex-工具"}},[t._v("#")]),t._v(" 可视化 Flex 工具")]),t._v(" "),s("p",[s("a",{attrs:{href:"https://the-echoplex.net/flexyboxes/",target:"_blank",rel:"noopener noreferrer"}},[t._v("flexyboxes"),s("OutboundLink")],1)])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/58.3d796bc8.js b/assets/js/58.3d796bc8.js new file mode 100644 index 0000000..ed7d9cd --- /dev/null +++ b/assets/js/58.3d796bc8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{500:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"获取手机号码"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#获取手机号码"}},[this._v("#")]),this._v(" 获取手机号码")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/59.81850be8.js b/assets/js/59.81850be8.js new file mode 100644 index 0000000..56d7233 --- /dev/null +++ b/assets/js/59.81850be8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[59],{501:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"获取用户信息"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#获取用户信息"}},[this._v("#")]),this._v(" 获取用户信息")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/6.a93485a2.js b/assets/js/6.a93485a2.js new file mode 100644 index 0000000..eb9a89d --- /dev/null +++ b/assets/js/6.a93485a2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{349:function(t,e,a){},351:function(t,e,a){},352:function(t,e,a){"use strict";a(349)},353:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(344),o=Object(r.c)({components:{RecoIcon:n.b},props:{pageInfo:{type:Object,default:()=>({})},currentTag:{type:String,default:""},showAccessNumber:{type:Boolean,default:!1}},setup(t,e){const a=Object(s.a)();return{numStyle:{fontSize:".9rem",fontWeight:"normal",color:"#999"},goTags:t=>{a.$route.path!==`/tag/${t}/`&&a.$router.push({path:`/tag/${t}/`})},formatDateValue:t=>new Intl.DateTimeFormat(a.$lang).format(new Date(t))}}}),c=(a(352),a(2)),i=Object(c.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",[t.pageInfo.frontmatter.author||t.$themeConfig.author?e("reco-icon",{attrs:{icon:"reco-account"}},[e("span",[t._v(t._s(t.pageInfo.frontmatter.author||t.$themeConfig.author))])]):t._e(),t._v(" "),t.pageInfo.frontmatter.date?e("reco-icon",{attrs:{icon:"reco-date"}},[e("span",[t._v(t._s(t.formatDateValue(t.pageInfo.frontmatter.date)))])]):t._e(),t._v(" "),!0===t.showAccessNumber?e("reco-icon",{attrs:{icon:"reco-eye"}},[e("AccessNumber",{attrs:{idVal:t.pageInfo.path,numStyle:t.numStyle}})],1):t._e(),t._v(" "),t.pageInfo.frontmatter.tags?e("reco-icon",{staticClass:"tags",attrs:{icon:"reco-tag"}},t._l(t.pageInfo.frontmatter.tags,(function(a,r){return e("span",{key:r,staticClass:"tag-item",class:{active:t.currentTag==a},on:{click:function(e){return e.stopPropagation(),t.goTags(a)}}},[t._v(t._s(a))])})),0):t._e()],1)}),[],!1,null,"8a445198",null);e.default=i.exports},354:function(t,e,a){},355:function(t,e,a){},362:function(t,e,a){"use strict";a(351)},364:function(t,e,a){"use strict";a.r(e);a(16);var r=a(0),n=a(345),s=a(353),o=Object(r.c)({components:{PageInfo:s.default,RecoIcon:n.b},props:["item","currentPage","currentTag"]}),c=(a(362),a(2)),i=Object(c.a)(o,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-item",on:{click:function(e){return t.$router.push(t.item.path)}}},[t.item.frontmatter.sticky?e("reco-icon",{attrs:{icon:"reco-sticky"}}):t._e(),t._v(" "),e("div",{staticClass:"title"},[t.item.frontmatter.keys?e("reco-icon",{attrs:{icon:"reco-lock"}}):t._e(),t._v(" "),e("router-link",{attrs:{to:t.item.path}},[t._v(t._s(t.item.title))])],1),t._v(" "),e("div",{staticClass:"abstract",domProps:{innerHTML:t._s(t.item.excerpt)}}),t._v(" "),e("PageInfo",{attrs:{pageInfo:t.item,currentTag:t.currentTag}})],1)}),[],!1,null,"73a63558",null);e.default=i.exports},365:function(t,e,a){"use strict";a(354)},366:function(t,e,a){"use strict";a(355)},371:function(t,e,a){},372:function(t,e,a){"use strict";a.r(e);var r=a(0),n={methods:{_getStoragePage(){const t=window.location.pathname,e=JSON.parse(sessionStorage.getItem("currentPage"));return null===e||t!==e.path?(sessionStorage.setItem("currentPage",JSON.stringify({page:1,path:""})),1):parseInt(e.page)},_setStoragePage(t){const e=window.location.pathname;sessionStorage.setItem("currentPage",JSON.stringify({page:t,path:e}))}}},s=a(364),o=a(344),c=Object(r.c)({mixins:[n],components:{NoteAbstractItem:s.default},props:["data","currentTag"],setup(t,e){const a=Object(o.a)(),{data:n}=Object(r.i)(t),s=Object(r.h)(1),c=Object(r.a)(()=>{const t=(s.value-1)*a.$perPage,e=s.value*a.$perPage;return n.value.slice(t,e)});return Object(r.e)(()=>{s.value=a._getStoragePage()||1}),{currentPage:s,currentPageData:c,getCurrentPage:t=>{s.value=t,a._setStoragePage(t),e.emit("paginationChange",t)}}},watch:{$route(){this.currentPage=this._getStoragePage()||1}}}),i=(a(365),a(2)),u=Object(i.a)(c,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("div",{staticClass:"abstract-wrapper"},[t._l(t.currentPageData,(function(a){return e("NoteAbstractItem",{key:a.path,attrs:{item:a,currentPage:t.currentPage,currentTag:t.currentTag}})})),t._v(" "),e("pagation",{staticClass:"pagation",attrs:{total:t.data.length,currentPage:t.currentPage},on:{getCurrentPage:t.getCurrentPage}})],2)}),[],!1,null,"21a20f36",null);e.default=u.exports},398:function(t,e,a){"use strict";a(371)},422:function(t,e,a){},450:function(t,e,a){"use strict";a(422)},482:function(t,e,a){"use strict";a.r(e);var r=a(0),n=a(399),s=a(372),o=a(27),c=a(43),i=a(344),u=Object(r.c)({components:{Common:n.default,NoteAbstract:s.default},setup(t,e){const a=Object(i.a)();return{posts:Object(r.a)(()=>{let t=a.$currentCategories.pages;return t=Object(o.a)(t),Object(o.c)(t),t}),title:Object(r.a)(()=>a.$currentCategories.key),getOneColor:c.b,getCurrentTag:t=>{e.emit("currentTag",t)},paginationChange:t=>{setTimeout(()=>{window.scrollTo(0,0)},100)}}}}),g=(a(366),a(398),a(450),a(2)),l=Object(g.a)(u,(function(){var t=this,e=t._self._c;t._self._setupProxy;return e("Common",{staticClass:"categories-wrapper",attrs:{sidebar:!1}},[e("ul",{staticClass:"category-wrapper"},t._l(t.$categoriesList,(function(a,r){return e("li",{directives:[{name:"show",rawName:"v-show",value:a.pages.length>0,expression:"item.pages.length > 0"}],key:r,staticClass:"category-item",class:t.title==a.name?"active":""},[e("router-link",{attrs:{to:a.path}},[e("span",{staticClass:"category-name"},[t._v(t._s(a.name))]),t._v(" "),e("span",{staticClass:"post-num",style:{backgroundColor:t.getOneColor()}},[t._v(t._s(a.pages.length))])])],1)})),0),t._v(" "),e("note-abstract",{staticClass:"list",attrs:{data:t.posts},on:{paginationChange:t.paginationChange}})],1)}),[],!1,null,"ef66d4da",null);e.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/60.77e7bae6.js b/assets/js/60.77e7bae6.js new file mode 100644 index 0000000..12dcdc0 --- /dev/null +++ b/assets/js/60.77e7bae6.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[60],{502:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"保存图片到相册"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#保存图片到相册"}},[t._v("#")]),t._v(" 保存图片到相册")]),t._v(" "),s("p",[t._v("通常有几种方式基于"),s("code",[t._v("流")]),t._v("、"),s("code",[t._v("图片资源URL")]),t._v("、"),s("code",[t._v("Base64")]),t._v("。")]),t._v(" "),s("h2",{attrs:{id:"添加响应头"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#添加响应头"}},[t._v("#")]),t._v(" 添加响应头")]),t._v(" "),s("ul",[s("li",[t._v("Content-Disposition: 'attachmeent'")]),t._v(" "),s("li",[t._v("Content-Type: application/octet-stream")])]),t._v(" "),s("h2",{attrs:{id:"如何在-base64-示例中应用-url-createobjecturl"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#如何在-base64-示例中应用-url-createobjecturl"}},[t._v("#")]),t._v(" 如何在 "),s("code",[t._v("base64")]),t._v(" 示例中应用 "),s("code",[t._v("URL.createObjectURL()")])]),t._v(" "),s("ul",[s("li",[s("ol",[s("li",[t._v("如何把 base 64 转换为 blob")])])])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" base64StringToBlob "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'blob-util'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" contentType "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'image/png'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" b64Data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'iVb........'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// base64 数据")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" blob "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("base64StringToBlob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("b64Data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" contentType"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[s("ol",{attrs:{start:"2"}},[s("li",[t._v("base64 转换为 blob")])])])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" byteCharacters "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("atob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("b64"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" byteNumbers "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Array")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("byteCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" byteCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" i"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n byteNumbers"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" byteCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("charCodeAt")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" byteArray "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Uint8Array")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("byteNumbers"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" blob "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Blob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("byteArray"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'audio/mp3'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[s("ol",{attrs:{start:"3"}},[s("li",[t._v("下载示例")])])])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("dataURLtoBlob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("dataurl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" arr "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" dataurl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("split")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("','")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" mime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" arr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("match")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token regex"}},[s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")]),s("span",{pre:!0,attrs:{class:"token regex-source language-regex"}},[t._v(":(.*?);")]),s("span",{pre:!0,attrs:{class:"token regex-delimiter"}},[t._v("/")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" bstr "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("atob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("arr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" n "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" bstr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" u8arr "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Uint8Array")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("while")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("n"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n u8arr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" bstr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("charCodeAt")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Blob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("u8arr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("type")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" mime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("downloadFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'defalut'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" document"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createElement")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'a'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setAttribute")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'href'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" url"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setAttribute")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'download'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setAttribute")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'target'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'_blank'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" clickEvent "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" document"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createEvent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'MouseEvents'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n clickEvent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initEvent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'click'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("dispatchEvent")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("clickEvent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("downloadFileByBase64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("base64"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" myBlob "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("dataURLtoBlob")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("base64"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" myUrl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("URL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createObjectURL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myBlob"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("downloadFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myUrl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/61.e25142a0.js b/assets/js/61.e25142a0.js new file mode 100644 index 0000000..7efd960 --- /dev/null +++ b/assets/js/61.e25142a0.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[61],{504:function(t,n,s){"use strict";s.r(n);var e=s(2),r=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"uniapp-打包发布-h5"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#uniapp-打包发布-h5"}},[this._v("#")]),this._v(" Uniapp 打包发布 H5")]),this._v(" "),t("p",[t("a",{attrs:{href:"https://blog.csdn.net/wcdunf/article/details/123177852",target:"_blank",rel:"noopener noreferrer"}},[this._v("uniapp 打包发布H5 nginx 访问"),t("OutboundLink")],1)])])}),[],!1,null,null,null);n.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/62.2f090d6c.js b/assets/js/62.2f090d6c.js new file mode 100644 index 0000000..09acf90 --- /dev/null +++ b/assets/js/62.2f090d6c.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[62],{505:function(t,r,e){"use strict";e.r(r);var a=e(2),n=Object(a.a)({},(function(){var t=this,r=t._self._c;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h1",{attrs:{id:"简介"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#简介"}},[t._v("#")]),t._v(" 简介")]),t._v(" "),r("img",{attrs:{src:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/1ae87107-2943-4ba6-be2b-390ca27c6260.png"}}),t._v(" "),r("h2",{attrs:{id:"参考文档"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#参考文档"}},[t._v("#")]),t._v(" 参考文档")]),t._v(" "),r("ul",[r("li",[r("a",{attrs:{href:"https://www.html5plus.org/doc/zh_cn/runtime.html#",target:"_blank",rel:"noopener noreferrer"}},[t._v("HTML5 + 规范"),r("OutboundLink")],1)]),t._v(" "),r("li",[r("a",{attrs:{href:"https://ask.dcloud.net.cn/explore/",target:"_blank",rel:"noopener noreferrer"}},[t._v("DCloud问答"),r("OutboundLink")],1)])])])}),[],!1,null,null,null);r.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/63.0a12a774.js b/assets/js/63.0a12a774.js new file mode 100644 index 0000000..4b3069e --- /dev/null +++ b/assets/js/63.0a12a774.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[63],{506:function(t,s,a){"use strict";a.r(s);var r=a(2),l=Object(r.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"ios-打包构建"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#ios-打包构建"}},[t._v("#")]),t._v(" iOS 打包构建")]),t._v(" "),s("ol",[s("li",[t._v("先创建证书")])]),t._v(" "),s("p",[t._v("https://ask.dcloud.net.cn/article/152")]),t._v(" "),s("ol",{attrs:{start:"2"}},[s("li",[t._v("选择证书打包")])])])}),[],!1,null,null,null);s.default=l.exports}}]); \ No newline at end of file diff --git a/assets/js/64.f1164df1.js b/assets/js/64.f1164df1.js new file mode 100644 index 0000000..578008a --- /dev/null +++ b/assets/js/64.f1164df1.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[64],{510:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"本地存储"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#本地存储"}},[this._v("#")]),this._v(" 本地存储")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/65.43eb836f.js b/assets/js/65.43eb836f.js new file mode 100644 index 0000000..fab8484 --- /dev/null +++ b/assets/js/65.43eb836f.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[65],{511:function(t,s,a){"use strict";a.r(s);var n=a(2),p=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"保存图片到相册"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#保存图片到相册"}},[t._v("#")]),t._v(" 保存图片到相册")]),t._v(" "),s("p",[t._v("同 APP 一样,小程序本身也是原生作为它的宿主环境。对于不同来源的图片,保存方式上存在差异。")]),t._v(" "),s("ul",[s("li",[t._v("网络图片")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("downloadFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("url")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'https://www.example.com/file/test'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//仅为示例,并非真实的资源")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("statusCode "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("===")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("200")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'save success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("本地图片(相册、相机)")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 单张")]),t._v("\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("chooseImage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("count")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("sourceType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'camera'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePaths"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'save success'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 批量")]),t._v("\nuni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("chooseImage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("count")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("sourceType")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'camera'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" tempFilePaths "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePaths"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" len "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" tempFilePathss"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" i "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" len"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" i"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" tempFilePaths"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("i"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存失败'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("ul",[s("li",[t._v("Canvas")])]),t._v(" "),s("p",[t._v("在小程序中基本上海报功能是一个常见的需求,涉及保存到相册就显得很常见。 小程序中提供了对应 API "),s("a",{attrs:{href:"https://uniapp.dcloud.io/api/canvas/canvasToTempFilePath.html#canvastotempfilepath",target:"_blank",rel:"noopener noreferrer"}},[s("code",[t._v("uni.canvasToTempFilePath")]),s("OutboundLink")],1),t._v(" 。把 Canvas 转换为临时文件目录,本质猜测底层跟 App 实现原理一样,先转换为 "),s("code",[t._v("Base64")]),t._v(" 再使用 "),s("code",[t._v("Bitmap")]),t._v(" 转为临时目录。")]),t._v(" "),s("p",[t._v("具体代码实现如下:")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("canvasToTempFilePath")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("canvasId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'canvas'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// canvasId")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("saveImageToPhotosAlbum")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("filePath")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" res"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("tempFilePath"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("success")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存成功'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存失败'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("fail")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'保存失败'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=p.exports}}]); \ No newline at end of file diff --git a/assets/js/66.12023686.js b/assets/js/66.12023686.js new file mode 100644 index 0000000..51b956d --- /dev/null +++ b/assets/js/66.12023686.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[66],{515:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"本地持久化"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#本地持久化"}},[this._v("#")]),this._v(" 本地持久化")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/67.35f888b7.js b/assets/js/67.35f888b7.js new file mode 100644 index 0000000..e95a0b7 --- /dev/null +++ b/assets/js/67.35f888b7.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[67],{516:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"海报分享"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#海报分享"}},[this._v("#")]),this._v(" 海报分享")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/68.745dff11.js b/assets/js/68.745dff11.js new file mode 100644 index 0000000..d4bb5c4 --- /dev/null +++ b/assets/js/68.745dff11.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[68],{525:function(t,a,s){"use strict";s.r(a);var n=s(2),e=Object(n.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"路由"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#路由"}},[t._v("#")]),t._v(" 路由")]),t._v(" "),a("h2",{attrs:{id:"为什么使用-uni-simple-router"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#为什么使用-uni-simple-router"}},[t._v("#")]),t._v(" 为什么使用 uni-simple-router")]),t._v(" "),a("p",[a("code",[t._v("uniapp")]),t._v(" 只提供基础路由的功能,能满足日常简单业务需求。往往实际的业务场景都会比较复杂,例如涉及权限的管控,哪些页面只能登录后访问。")]),t._v(" "),a("p",[t._v("针对这样的需求,在不引入外部插件的情况下,能想到的就是在页面级别的钩子中去完成,比如 "),a("code",[t._v("onLoad")]),t._v(" 中。 假设控制页面很多,可能需要在每个页面中添加对应鉴权逻辑。 为了减少代码重复,可以通过 "),a("code",[t._v("mixins")]),t._v(" 的方式共用其鉴权的逻辑。这些都不是理想的处理方式。 为什么? 首先 "),a("code",[t._v("minxins")]),t._v(" 并不够直观,这也就是 "),a("code",[t._v("vue3")]),t._v(" 放弃它的一个原因之一。其次一般页面级别守卫通常针对当前页面设计,并不能把全局(应用)级别控制的放入进来。")]),t._v(" "),a("p",[t._v("有没有像 "),a("code",[t._v("Vue-router")]),t._v(" 那样,既支持页面级、以及全局的守卫功能,答案有,也就是 "),a("a",{attrs:{href:"https://hhyang.cn/v2/start/tsUse.htmlhttps://hhyang.cn/v2/start/tsUse.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("uni-simple-router"),a("OutboundLink")],1),t._v("。")]),t._v(" "),a("p",[t._v("uni-simple-router 官方对其介绍如下:")]),t._v(" "),a("ul",[a("li",[t._v("首先属于它是 uniapp 的一个插件")]),t._v(" "),a("li",[t._v("简明优先 (语法同 vue-router 一样)")]),t._v(" "),a("li",[t._v("多端发布 (开发者编写一套代码可发布到多个平台)")])]),t._v(" "),a("p",[t._v("现在开始使用它吧。")]),t._v(" "),a("h2",{attrs:{id:"快速上手"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#快速上手"}},[t._v("#")]),t._v(" 快速上手")]),t._v(" "),a("p",[a("a",{attrs:{href:"https://hhyang.cn/v2/start/quickstart.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("参考官网提供快速上手"),a("OutboundLink")],1)]),t._v(" "),a("h2",{attrs:{id:"跨平台注意事项"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#跨平台注意事项"}},[t._v("#")]),t._v(" 跨平台注意事项")]),t._v(" "),a("p",[t._v("针对小程序的原生组件比如 "),a("code",[t._v("tabbar")]),t._v("、"),a("code",[t._v("header")]),t._v(" 这些动作出发页面跳转时,"),a("code",[t._v("uni-simple-router")]),t._v(" 是没办法拦截的,如果需要拦截这些页面,只能通过自定义 "),a("code",[t._v("tabbar")]),t._v("、"),a("code",[t._v("header")]),t._v(" 的方式来实现。")]),t._v(" "),a("p",[t._v("同样针对不同的端,也会有些注意事项:")]),t._v(" "),a("ul",[a("li",[t._v("H5 端")])]),t._v(" "),a("p",[t._v("在不考虑跨端的情况下,"),a("code",[t._v("uni-simple-router")]),t._v(" 完成可以像使用 "),a("code",[t._v("vue-router")]),t._v(" 的方式来使用它。")]),t._v(" "),a("ul",[a("li",[t._v("APP 端")])]),t._v(" "),a("p",[t._v("如果APP首页是通过 "),a("code",[t._v("nvue")]),t._v(" 的方式,您需要使用 "),a("code",[t._v("vue")]),t._v(" 来替代它,同时你需要在 "),a("code",[t._v("manifest.json")]),t._v(" 下把 "),a("code",[t._v("App常用其他设置")]),t._v(" 中的 "),a("code",[t._v("fast启动模式")]),t._v(" 关闭掉。打开源码视图对比以下配置:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 在源码视图下的 app-plus 节点下")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"splashscreen"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"alwaysShowBeforeRender"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("false")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"waiting"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"autoclose"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("false")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"delay"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("h2",{attrs:{id:"导航方式"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#导航方式"}},[t._v("#")]),t._v(" 导航方式")]),t._v(" "),a("p",[t._v("按照编写方式不同,分为: "),a("code",[t._v("组件式导航")]),t._v("、"),a("code",[t._v("编程式路由")]),t._v("。")]),t._v(" "),a("h3",{attrs:{id:"组件式导航"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#组件式导航"}},[t._v("#")]),t._v(" 组件式导航")]),t._v(" "),a("p",[t._v("顾名思义通过组件来进行页面跳转,同时为了兼容小程序,组件需要在 "),a("code",[t._v("main.js")]),t._v(" 中引入并注册")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// main.js")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" Mylink "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'./node_modules/uni-simple-router/dist/link.vue'")]),t._v("\nVue"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("component")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'my-link'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("Mylink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("使用:")]),t._v(" "),a("div",{staticClass:"language-html extra-class"},[a("pre",{pre:!0,attrs:{class:"language-html"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("\x3c!-- 一个简单的name跳转 --\x3e")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("my-link")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("to")]),a("span",{pre:!0,attrs:{class:"token attr-value"}},[a("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("{name: 'tabbar-4',params: {name: 'my-link'}}"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("button")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("type")]),a("span",{pre:!0,attrs:{class:"token attr-value"}},[a("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("primary"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("使用name对象跳转"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")])]),t._v("\n")])])]),a("h3",{attrs:{id:"编程式路由"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#编程式路由"}},[t._v("#")]),t._v(" 编程式路由")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",[t._v("uni-simple-router")]),t._v(" "),a("th",[t._v("uni-app")]),t._v(" "),a("th",[t._v("描述")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("router.push()")]),t._v(" "),a("td",[t._v("uni.navigateTo()")]),t._v(" "),a("td",[t._v("会在页面栈中添加路由记录。 注意事项,当提供了 path 时,则会忽略 params。同样提供 name 时,则会忽略 query。 通常 query 提供查询参,params 提供动态路由参数")])]),t._v(" "),a("tr",[a("td",[t._v("router.replace()")]),t._v(" "),a("td",[t._v("uni.redirectTo()")]),t._v(" "),a("td",[t._v("使用方式通过 push 一样,但是它不会在页面栈中新增记录,只会替换栈中当前记录信息。")])]),t._v(" "),a("tr",[a("td",[t._v("router.replaceAll()")]),t._v(" "),a("td",[t._v("uni.reLaunch()")]),t._v(" "),a("td",[t._v("将所有的页面都关掉,打开一个新的页面")])]),t._v(" "),a("tr",[a("td",[t._v("router.pushTab()")]),t._v(" "),a("td",[t._v("uni.switchTab()")]),t._v(" "),a("td",[t._v("打开 uni-app 自带的tab 菜单")])]),t._v(" "),a("tr",[a("td",[t._v("router.back(n,{...})")]),t._v(" "),a("td",[t._v("uni.navigateBack()")]),t._v(" "),a("td",[t._v("这个方法的参数是一个正整数,意思是在 history 记录中后退多少步,类似 "),a("code",[t._v("window.history.go(n)")])])])])]),t._v(" "),a("h2",{attrs:{id:"路由传参"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#路由传参"}},[t._v("#")]),t._v(" 路由传参")]),t._v(" "),a("ul",[a("li",[t._v("动态路由时传参注意事项")])]),t._v(" "),a("p",[t._v("通常路由支持 "),a("code",[t._v("动态路由")]),t._v(","),a("code",[t._v("通配符")]),t._v(" 以及 "),a("code",[t._v("全路径")]),t._v(" 的方式。 不同的路由方式在使用时,需要注意。当使用 uni 提供的 API 来进行动态路由跳转时,系统会出现警告。 正常的做法如下:")]),t._v(" "),a("div",{staticClass:"language-json extra-class"},[a("pre",{pre:!0,attrs:{class:"language-json"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// pages.json")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"pages"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"path"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"pages/page2/page2"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"aliasPath"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"/page2/:id"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"page2"')]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 跳转方式")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("$Router"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("push")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("name")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'page2'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("params")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("id")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("12")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("除了跳转之外,获取动态参数也需要注意,通常获取参数都是 "),a("code",[t._v("onLoad")]),t._v(" 中的 "),a("code",[t._v("options")]),t._v(" 。如果当前路由是动态参数时,"),a("code",[t._v("uni-app")]),t._v(" 是不能正确解析,那么只能通过如下方式获取:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("onLoad")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("options")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("options"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// {}")]),t._v("\n console"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("$Route"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// { id: 12}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("h2",{attrs:{id:"导航守卫-路由守卫"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#导航守卫-路由守卫"}},[t._v("#")]),t._v(" 导航守卫( 路由守卫 )")]),t._v(" "),a("h3",{attrs:{id:"全局路由守卫"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#全局路由守卫"}},[t._v("#")]),t._v(" 全局路由守卫")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",[t._v("钩子")]),t._v(" "),a("th",[t._v("描述")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("router.beforeEach()")]),t._v(" "),a("td",[t._v("全局导航前置钩子")])]),t._v(" "),a("tr",[a("td",[t._v("router.afterEach()")]),t._v(" "),a("td",[t._v("全局导航后置钩子")])])])]),t._v(" "),a("h3",{attrs:{id:"路由独享的守卫"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#路由独享的守卫"}},[t._v("#")]),t._v(" 路由独享的守卫")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",[t._v("钩子")]),t._v(" "),a("th",[t._v("描述")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("beforeEnter")]),t._v(" "),a("td",[t._v("全局导航前置钩子")])])])]),t._v(" "),a("h3",{attrs:{id:"组件内的守卫"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#组件内的守卫"}},[t._v("#")]),t._v(" 组件内的守卫")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",[t._v("钩子")]),t._v(" "),a("th",[t._v("描述")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("beforeRouteLeave")]),t._v(" "),a("td",[t._v("在组件内配置")])])])]),t._v(" "),a("h3",{attrs:{id:"插件构建时的守卫"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#插件构建时的守卫"}},[t._v("#")]),t._v(" 插件构建时的守卫")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" router "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("createRouter")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("platform")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" process"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("env"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("VUE_APP_PLATFORM")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("routerBeforeEach")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("to"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" from"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" next")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 每次导航触发前都会执行这个,比所有守卫都先执行")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("next")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("routerAfterEach")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("to"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 跳转结束后执行 守卫守卫执行完毕后再执行")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("routerErrorEach")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("error"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" router")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 跳转时错误后执行的守卫")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"完整的导航解析流程"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#完整的导航解析流程"}},[t._v("#")]),t._v(" 完整的导航解析流程")]),t._v(" "),a("ol",[a("li",[a("p",[t._v("导航被触发。")])]),t._v(" "),a("li",[a("p",[t._v("调用插件 "),a("code",[t._v("routerBeforeEach")]),t._v(" 钩子")])]),t._v(" "),a("li",[a("p",[t._v("在失活的组件里调用离开守卫 "),a("code",[t._v("beforeRouteLeave")]),t._v("。")])]),t._v(" "),a("li",[a("p",[t._v("调用全局的 "),a("code",[t._v("beforeEach")]),t._v(" 守卫。")])]),t._v(" "),a("li",[a("p",[t._v("在路由配置里调用 "),a("code",[t._v("beforeEnter")]),t._v("。")])]),t._v(" "),a("li",[a("p",[t._v("导航被确认。")])]),t._v(" "),a("li",[a("p",[t._v("调用全局的 "),a("code",[t._v("afterEach")]),t._v(" 钩子。")])]),t._v(" "),a("li",[a("p",[t._v("调用插件 "),a("code",[t._v("routerAfterEach")]),t._v(" 钩子")])]),t._v(" "),a("li",[a("p",[a("code",[t._v("H5端")]),t._v(" 触发 "),a("code",[t._v("DOM")]),t._v(" 更新,"),a("code",[t._v("其他端")]),t._v(" 底层调用 "),a("code",[t._v("uni Api")])])])])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/69.5314b60c.js b/assets/js/69.5314b60c.js new file mode 100644 index 0000000..696ec1f --- /dev/null +++ b/assets/js/69.5314b60c.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[69],{518:function(t,r,e){"use strict";e.r(r);var n=e(2),a=Object(n.a)({},(function(){var t=this,r=t._self._c;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h1",{attrs:{id:"配置-android-、ios-渠道"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#配置-android-、ios-渠道"}},[t._v("#")]),t._v(" 配置 Android 、iOS 渠道")]),t._v(" "),r("h2",{attrs:{id:"参考文档"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#参考文档"}},[t._v("#")]),t._v(" 参考文档")]),t._v(" "),r("ul",[r("li",[r("a",{attrs:{href:"https://ask.dcloud.net.cn/article/409",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android平台设置UrlSchemes,实现被第三方应用调用"),r("OutboundLink")],1)]),t._v(" "),r("li",[r("a",{attrs:{href:"https://ask.dcloud.net.cn/article/64",target:"_blank",rel:"noopener noreferrer"}},[t._v("iOS平台设置UrlSchemes,实现被第三方应用调用"),r("OutboundLink")],1)])])])}),[],!1,null,null,null);r.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/7.271a0b63.js b/assets/js/7.271a0b63.js new file mode 100644 index 0000000..cd9080f --- /dev/null +++ b/assets/js/7.271a0b63.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{394:function(e,t,a){},396:function(e,t,a){},397:function(e,t,a){},411:function(e){e.exports=JSON.parse('{"a":"1.6.17"}')},412:function(e,t,a){"use strict";a(394)},414:function(e,t,a){"use strict";a(396)},415:function(e,t,a){"use strict";a(397)},424:function(e,t,a){},425:function(e,t,a){},433:function(e,t,a){"use strict";a.r(t);var o=a(0),s=a(345),r=a(411),n=a(344),i=Object(o.c)({components:{RecoIcon:s.b},setup(e,t){const a=Object(n.a)(),s=Object(o.a)(()=>{var e,t;const o=null==a||null===(e=a.$themeConfig)||void 0===e?void 0:e.valineConfig,s=(null==a||null===(t=a.$themeLocaleConfig)||void 0===t?void 0:t.valineConfig)||o;return s&&0!=s.visitor});return{version:r.a,showAccessNumber:s}}}),c=(a(412),a(2)),l=Object(c.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"footer-wrapper"},[t("span",[t("reco-icon",{attrs:{icon:"reco-theme"}}),e._v(" "),t("a",{attrs:{target:"blank",href:"https://vuepress-theme-reco.recoluan.com"}},[e._v(e._s("vuepress-theme-reco@"+e.version))])],1),e._v(" "),e.$themeConfig.record?t("span",[t("reco-icon",{attrs:{icon:"reco-beian"}}),e._v(" "),t("a",{attrs:{href:e.$themeConfig.recordLink||"#"}},[e._v(e._s(e.$themeConfig.record))])],1):e._e(),e._v(" "),t("span",[t("reco-icon",{attrs:{icon:"reco-copyright"}}),e._v(" "),t("a",[e.$themeConfig.author?t("span",[e._v(e._s(e.$themeConfig.author))]):e._e(),e._v("\n   \n "),e.$themeConfig.startYear&&e.$themeConfig.startYear!=(new Date).getFullYear()?t("span",[e._v(e._s(e.$themeConfig.startYear)+" - ")]):e._e(),e._v("\n "+e._s((new Date).getFullYear())+"\n ")])],1),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.showAccessNumber,expression:"showAccessNumber"}]},[t("reco-icon",{attrs:{icon:"reco-eye"}}),e._v(" "),t("AccessNumber",{attrs:{idVal:"/"}})],1),e._v(" "),e.$themeConfig.cyberSecurityRecord?t("p",{staticClass:"cyber-security"},[t("img",{attrs:{src:"https://img.alicdn.com/tfs/TB1..50QpXXXXX7XpXXXXXXXXXX-40-40.png",alt:""}}),e._v(" "),t("a",{attrs:{href:e.$themeConfig.cyberSecurityLink||"#"}},[e._v(e._s(e.$themeConfig.cyberSecurityRecord))])]):e._e(),e._v(" "),t("Comments",{attrs:{isShowComments:!1}})],1)}),[],!1,null,"29dae040",null);t.default=l.exports},435:function(e,t,a){"use strict";a.r(t);var o=a(0),s=a(356),r=a(345),n=a(344),i=Object(o.c)({components:{NavLink:s.default,ModuleTransition:r.a},setup(e,t){const a=Object(n.a)();return{recoShowModule:Object(n.b)(),actionLink:Object(o.a)(()=>a&&{link:a.$frontmatter.actionLink,text:a.$frontmatter.actionText}),heroImageStyle:Object(o.a)(()=>a.$frontmatter.heroImageStyle||{maxHeight:"200px",margin:"6rem auto 1.5rem"})}}}),c=(a(414),a(2)),l=Object(c.a)(i,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"home"},[t("div",{staticClass:"hero"},[t("ModuleTransition",[e.recoShowModule&&e.$frontmatter.heroImage?t("img",{style:e.heroImageStyle||{},attrs:{src:e.$withBase(e.$frontmatter.heroImage),alt:"hero"}}):e._e()]),e._v(" "),t("ModuleTransition",{attrs:{delay:"0.04"}},[e.recoShowModule&&null!==e.$frontmatter.heroText?t("h1",{style:{marginTop:e.$frontmatter.heroImage?"0px":"140px"}},[e._v("\n "+e._s(e.$frontmatter.heroText||e.$title||"vuePress-theme-reco")+"\n ")]):e._e()]),e._v(" "),t("ModuleTransition",{attrs:{delay:"0.08"}},[e.recoShowModule&&null!==e.$frontmatter.tagline?t("p",{staticClass:"description"},[e._v("\n "+e._s(e.$frontmatter.tagline||e.$description||"Welcome to your vuePress-theme-reco site")+"\n ")]):e._e()]),e._v(" "),t("ModuleTransition",{attrs:{delay:"0.16"}},[e.recoShowModule&&e.$frontmatter.actionText&&e.$frontmatter.actionLink?t("p",{staticClass:"action"},[t("NavLink",{staticClass:"action-button",attrs:{item:e.actionLink}})],1):e._e()])],1),e._v(" "),t("ModuleTransition",{attrs:{delay:"0.24"}},[e.recoShowModule&&e.$frontmatter.features&&e.$frontmatter.features.length?t("div",{staticClass:"features"},e._l(e.$frontmatter.features,(function(a,o){return t("div",{key:o,staticClass:"feature"},[t("h2",[e._v(e._s(a.title))]),e._v(" "),t("p",[e._v(e._s(a.details))])])})),0):e._e()]),e._v(" "),t("ModuleTransition",{attrs:{delay:"0.32"}},[t("Content",{directives:[{name:"show",rawName:"v-show",value:e.recoShowModule,expression:"recoShowModule"}],staticClass:"home-center",attrs:{custom:""}})],1)],1)}),[],!1,null,null,null);t.default=l.exports},436:function(e,t,a){"use strict";a.r(t);a(16);var o=a(0),s=a(353),r=a(17),n=a(344);function i(e,t,a){const o=[];!function e(t,a){for(let o=0,s=t.length;o{const{isShowComments:e}=a.$frontmatter,{showComment:t}=a.$themeConfig.valineConfig||{showComment:!0};return!1!==t&&!1!==e||!1===t&&!0===e}),u=Object(o.a)(()=>{const{$themeConfig:{valineConfig:e},$themeLocaleConfig:{valineConfig:t}}=a||{},o=t||e;return o&&0!=o.visitor}),m=Object(o.a)(()=>!1!==a.$themeConfig.lastUpdated&&a.$page.lastUpdated),d=Object(o.a)(()=>"string"==typeof a.$themeLocaleConfig.lastUpdated?a.$themeLocaleConfig.lastUpdated:"string"==typeof a.$themeConfig.lastUpdated?a.$themeConfig.lastUpdated:"Last Updated"),p=Object(o.a)(()=>{const e=a.$frontmatter.prev;return!1===e?void 0:e?Object(r.k)(a.$site.pages,e,a.$route.path):(t=a.$page,o=s.value,i(t,o,-1));var t,o}),h=Object(o.a)(()=>{const e=a.$frontmatter.next;return!1===h?void 0:e?Object(r.k)(a.$site.pages,e,a.$route.path):(t=a.$page,o=s.value,i(t,o,1));var t,o}),f=Object(o.a)(()=>{if(!1===a.$frontmatter.editLink)return!1;const{repo:e,editLinks:t,docsDir:o="",docsBranch:s="master",docsRepo:n=e}=a.$themeConfig;return n&&t&&a.$page.relativePath?function(e,t,a,o,s){if(/bitbucket.org/.test(e)){return(r.i.test(t)?t:e).replace(r.c,"")+"/src"+`/${o}/`+(a?a.replace(r.c,"")+"/":"")+s+`?mode=edit&spa=0&at=${o}&fileviewer=file-view-default`}return(r.i.test(t)?t:"https://github.com/"+t).replace(r.c,"")+"/edit"+`/${o}/`+(a?a.replace(r.c,"")+"/":"")+s}(e,n,o,s,a.$page.relativePath):""}),v=Object(o.a)(()=>a.$themeLocaleConfig.editLinkText||a.$themeConfig.editLinkText||"Edit this page"),_=Object(o.a)(()=>a.$showSubSideBar?{}:{paddingRight:"0"});return{recoShowModule:c,shouldShowComments:l,showAccessNumber:u,lastUpdated:m,lastUpdatedText:d,prev:p,next:h,editLink:f,editLinkText:v,pageStyle:_}}}),l=(a(415),a(2)),u=Object(l.a)(c,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("main",{staticClass:"page",style:e.pageStyle},[t("section",{directives:[{name:"show",rawName:"v-show",value:e.recoShowModule,expression:"recoShowModule"}]},[t("div",{staticClass:"page-title"},[t("h1",{staticClass:"title"},[e._v(e._s(e.$page.title))]),e._v(" "),t("PageInfo",{attrs:{pageInfo:e.$page,showAccessNumber:e.showAccessNumber}})],1),e._v(" "),t("Content",{staticClass:"theme-reco-content"})],1),e._v(" "),e.recoShowModule?t("footer",{staticClass:"page-edit"},[e.editLink?t("div",{staticClass:"edit-link"},[t("a",{attrs:{href:e.editLink,target:"_blank",rel:"noopener noreferrer"}},[e._v(e._s(e.editLinkText))]),e._v(" "),t("OutboundLink")],1):e._e(),e._v(" "),e.lastUpdated?t("div",{staticClass:"last-updated"},[t("span",{staticClass:"prefix"},[e._v(e._s(e.lastUpdatedText)+": ")]),e._v(" "),t("span",{staticClass:"time"},[e._v(e._s(e.lastUpdated))])]):e._e()]):e._e(),e._v(" "),e.recoShowModule&&(e.prev||e.next)?t("div",{staticClass:"page-nav"},[t("p",{staticClass:"inner"},[e.prev?t("span",{staticClass:"prev"},[e.prev?t("router-link",{staticClass:"prev",attrs:{to:e.prev.path}},[e._v("\n "+e._s(e.prev.title||e.prev.path)+"\n ")]):e._e()],1):e._e(),e._v(" "),e.next?t("span",{staticClass:"next"},[e.next?t("router-link",{attrs:{to:e.next.path}},[e._v("\n "+e._s(e.next.title||e.next.path)+"\n ")]):e._e()],1):e._e()])]):e._e(),e._v(" "),e.recoShowModule?t("Comments",{attrs:{isShowComments:e.shouldShowComments}}):e._e()],1)}),[],!1,null,null,null);t.default=u.exports},453:function(e,t,a){"use strict";a(424)},454:function(e,t,a){"use strict";a(425)},483:function(e,t,a){"use strict";a.r(t);var o=a(0),s=a(435),r=a(476),n=a(436),i=a(433),c=a(399),l=a(17),u=a(344),m=a(345),d=Object(o.c)({components:{HomeBlog:r.default,Home:s.default,Page:n.default,Common:c.default,Footer:i.default,ModuleTransition:m.a},setup(e,t){const a=Object(u.a)(),s=Object(o.a)(()=>{const{$page:e,$site:t,$localePath:o}=a;return e?Object(l.l)(e,e.regularPath,t,o):[]}),r=Object(o.a)(()=>{const{type:e}=a.$themeConfig||{};return e?"blog"==e?"HomeBlog":e:"Home"}),n=Object(o.h)(!1);Object(o.e)(()=>{n.value=!0});const i=Object(o.a)(()=>null==a?void 0:a.$page.path);return{sidebarItems:s,homeCom:r,show:n,path:i}}}),p=(a(453),a(454),a(2)),h=Object(p.a)(d,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("Common",{attrs:{sidebarItems:e.sidebarItems,showModule:e.show}},[e.$frontmatter.home?t(e.homeCom,{tag:"component"}):t("div",[e.sidebarItems.length>0?t("ModuleTransition",[t("Page",{key:e.path,attrs:{"sidebar-items":e.sidebarItems}})],1):t("Page",{key:e.path,attrs:{"sidebar-items":e.sidebarItems}})],1),e._v(" "),e.$frontmatter.home?t("Footer",{staticClass:"footer"}):e._e()],1)}),[],!1,null,null,null);t.default=h.exports}}]); \ No newline at end of file diff --git a/assets/js/70.e10f7e61.js b/assets/js/70.e10f7e61.js new file mode 100644 index 0000000..230340d --- /dev/null +++ b/assets/js/70.e10f7e61.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[70],{519:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"获取权限"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#获取权限"}},[this._v("#")]),this._v(" 获取权限")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/71.a8253d19.js b/assets/js/71.a8253d19.js new file mode 100644 index 0000000..3d29e02 --- /dev/null +++ b/assets/js/71.a8253d19.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[71],{520:function(t,s,a){"use strict";a.r(s);var n=a(2),r=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"动态设置导航"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#动态设置导航"}},[t._v("#")]),t._v(" 动态设置导航")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setNavigationBarTitle")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/72.e6276f31.js b/assets/js/72.e6276f31.js new file mode 100644 index 0000000..9f5e7a4 --- /dev/null +++ b/assets/js/72.e6276f31.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[72],{521:function(t,s,a){"use strict";a.r(s);var n=a(2),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"状态管理"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#状态管理"}},[t._v("#")]),t._v(" 状态管理")]),t._v(" "),s("h2",{attrs:{id:"安装-pinia-plugin-persistedstate"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#安装-pinia-plugin-persistedstate"}},[t._v("#")]),t._v(" 安装 pinia-plugin-persistedstate")]),t._v(" "),s("blockquote",[s("p",[t._v("npm i pinia-plugin-persistedstate -S")])]),t._v(" "),s("h2",{attrs:{id:"定义-store"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#定义-store"}},[t._v("#")]),t._v(" 定义 Store")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" createPinia "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'pinia'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" piniaPluginPersistedstate "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'pinia-plugin-persistedstate'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" store "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createPinia")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\nstore"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("use")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("piniaPluginPersistedstate"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" store"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("h2",{attrs:{id:"引入-store"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#引入-store"}},[t._v("#")]),t._v(" 引入 Store")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" createSSRApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'vue'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" App "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'./App.vue'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" Store "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@/store/index.js'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createApp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" app "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("createSSRApp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("App"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n app"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("use")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Store"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n app"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"持久化"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#持久化"}},[t._v("#")]),t._v(" 持久化")]),t._v(" "),s("p",[t._v("默认情况下,pinia 的状态是瞬时的,这意味着在应用刷新或重新打开时,状态会丢失。然而,对于某些用户信息,如登录凭证,我们需要将其持久化存储,以便在后续请求中使用。")]),t._v(" "),s("p",[s("code",[t._v("pinia-plugin-persistedstate")]),t._v(" 是专为 "),s("code",[t._v("pinia")]),t._v(" 设计的持久化插件,默认情况下使用 "),s("code",[t._v("localStorage")]),t._v(" 进行存储。然而,在小程序或 APP 中并没有 "),s("code",[t._v("localStorage")]),t._v(" 对象的支持。")]),t._v(" "),s("p",[t._v("好在 "),s("code",[t._v("pinia-plugin-persistedstate")]),t._v(" 支持传入自定义的 "),s("code",[t._v("storage")]),t._v(" 对象。")]),t._v(" "),s("p",[t._v("为在 "),s("code",[t._v("H5")]),t._v("、"),s("code",[t._v("小程序")]),t._v("和 "),s("code",[t._v("APP")]),t._v(" 中统一使用持久化存储,你可以通过自定义 "),s("code",[t._v("storage")]),t._v(" 来实现。在自定义 storage 时,需要知道 "),s("code",[t._v("storage")]),t._v(" 对象需要什么。")]),t._v(" "),s("h3",{attrs:{id:"storage-定义"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#storage-定义"}},[t._v("#")]),t._v(" storage 定义")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("type StorageLike "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Pick"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("Storage"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'getItem'")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'setItem'")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("也就是只需要提供一个 "),s("code",[t._v("get")]),t._v("、"),s("code",[t._v("set")]),t._v("方法即可。")]),t._v(" "),s("h3",{attrs:{id:"实现自定义-storage"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#实现自定义-storage"}},[t._v("#")]),t._v(" 实现自定义 Storage")]),t._v(" "),s("p",[t._v("在不同的上下文中,"),s("code",[t._v("uni.getStorageSync")]),t._v(" 会调用相应的存储 "),s("code",[t._v("API")]),t._v(",因此可以直接使用它来实现自定义存储。")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" defineStore "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'pinia'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" getUserInfo"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" getOpenId "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'@/api/user'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" useUserStore "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("defineStore")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'user'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("state")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("token")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("userInfo")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("openId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("unionId")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("sessionKey")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("''")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("getters")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("isLogin")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("token"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("isAdmin")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" userInfo "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("userInfo"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n userInfo "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&&")]),t._v("\n userInfo"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rolePermission "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&&")]),t._v("\n userInfo"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rolePermission"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("includes")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'admin'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("persist")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("storage")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("getItem")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getStorageSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("setItem")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" value")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setStorageSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" value"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/73.595bf648.js b/assets/js/73.595bf648.js new file mode 100644 index 0000000..97e76b5 --- /dev/null +++ b/assets/js/73.595bf648.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[73],{522:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"上传图片"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#上传图片"}},[this._v("#")]),this._v(" 上传图片")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/74.ea44f90d.js b/assets/js/74.ea44f90d.js new file mode 100644 index 0000000..6b4b678 --- /dev/null +++ b/assets/js/74.ea44f90d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[74],{529:function(t,s,a){"use strict";a.r(s);var n=a(2),r=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"响应式单位"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#响应式单位"}},[t._v("#")]),t._v(" 响应式单位")]),t._v(" "),s("h2",{attrs:{id:"尺寸单位"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#尺寸单位"}},[t._v("#")]),t._v(" 尺寸单位")]),t._v(" "),s("p",[s("a",{attrs:{href:"https://uniapp.dcloud.io/tutorial/syntax-css.html#%E5%B0%BA%E5%AF%B8%E5%8D%95%E4%BD%8D",target:"_blank",rel:"noopener noreferrer"}},[t._v("尺寸单位"),s("OutboundLink")],1)]),t._v(" "),s("h2",{attrs:{id:"单位之间的转换"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#单位之间的转换"}},[t._v("#")]),t._v(" 单位之间的转换")]),t._v(" "),s("ul",[s("li",[t._v("uniapp px rpx 互相转换")])]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 100rpx to px")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" px "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("upx2px")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 200px to rpx")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" rpx "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("200")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("uni"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("upx2px")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/75.a127334e.js b/assets/js/75.a127334e.js new file mode 100644 index 0000000..ccff098 --- /dev/null +++ b/assets/js/75.a127334e.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[75],{523:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("vite")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/76.aa8fc00c.js b/assets/js/76.aa8fc00c.js new file mode 100644 index 0000000..4b528fb --- /dev/null +++ b/assets/js/76.aa8fc00c.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[76],{524:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("vue")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/77.4aafab89.js b/assets/js/77.4aafab89.js new file mode 100644 index 0000000..54efa73 --- /dev/null +++ b/assets/js/77.4aafab89.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[77],{527:function(t,n,s){"use strict";s.r(n);var e=s(2),o=Object(e.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("p",[this._v("webpack")])])}),[],!1,null,null,null);n.default=o.exports}}]); \ No newline at end of file diff --git a/assets/js/78.2756c34e.js b/assets/js/78.2756c34e.js new file mode 100644 index 0000000..e4e3c98 --- /dev/null +++ b/assets/js/78.2756c34e.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[78],{528:function(e,t,v){"use strict";v.r(t);var o=v(2),_=Object(o.a)({},(function(){var e=this,t=e._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("h1",{attrs:{id:"常见问题"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#常见问题"}},[e._v("#")]),e._v(" 常见问题")]),e._v(" "),t("ul",[t("li",[e._v("获取微信 accessToken 报错,错误如下:")])]),e._v(" "),t("blockquote",[t("p",[e._v('{"errcode":40164,"errmsg":"invalid ip 118.250.108.249 ipv6 ::ffff:118.250.108.249, not in whitelist rid: 626122d8-46f3010d-639daae4"}')])]),e._v(" "),t("p",[e._v("错误信息很明显,IP白名单问题,大概步骤:")]),e._v(" "),t("p",[t("code",[e._v("登录公众平台")]),e._v(" > "),t("code",[e._v("开发")]),e._v(" > "),t("code",[e._v("基本配置")]),e._v(" > "),t("code",[e._v("IP白名单")]),e._v(" > "),t("code",[e._v("查看")]),e._v(" > "),t("code",[e._v('修改 >将ip地址添加进去,多个通过 "," 逗号分隔')]),e._v(" > "),t("code",[e._v('点击"确认修改"')])])])}),[],!1,null,null,null);t.default=_.exports}}]); \ No newline at end of file diff --git a/assets/js/79.75941f4a.js b/assets/js/79.75941f4a.js new file mode 100644 index 0000000..be7f32c --- /dev/null +++ b/assets/js/79.75941f4a.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[79],{526:function(t,s,n){"use strict";n.r(s);var r=n(2),a=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h1",{attrs:{id:"配置环境"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#配置环境"}},[this._v("#")]),this._v(" 配置环境")])])}),[],!1,null,null,null);s.default=a.exports}}]); \ No newline at end of file diff --git a/assets/js/8.af2db2fa.js b/assets/js/8.af2db2fa.js new file mode 100644 index 0000000..4118824 --- /dev/null +++ b/assets/js/8.af2db2fa.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[8,35,37],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));n(134);var o=n(0);function s(){const e=Object(o.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function i(){const e=Object(o.h)(!1);return Object(o.e)(()=>{e.value=!0}),Object(o.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},350:function(e,t,n){},357:function(e,t,n){"use strict";n.r(t);var o=n(0),s=Object(o.c)({name:"DropdownTransition",setup:(e,t)=>({setHeight:e=>{e.style.height=e.scrollHeight+"px"},unsetHeight:e=>{e.style.height=""}})}),i=(n(358),n(2)),l=Object(i.a)(s,(function(){var e=this._self._c;this._self._setupProxy;return e("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);t.default=l.exports},358:function(e,t,n){"use strict";n(350)},360:function(e,t,n){},369:function(e,t,n){},374:function(e,t,n){"use strict";n(360)},379:function(e,t,n){"use strict";n.r(t);var o=n(0),s=n(401),i=n(383),l=n(17),r=n(344);var a=Object(o.c)({name:"SidebarLinks",components:{SidebarGroup:s.default,SidebarLink:i.default},props:["items","depth","sidebarDepth"],setup(e,t){const n=Object(r.a)(),{items:s}=Object(o.i)(e),i=Object(o.h)(0),a=()=>{const e=function(e,t){for(let n=0;n"page"===t.type&&Object(l.e)(e,t.path)))return n}return-1}(n.$route,s.value);e>-1&&(i.value=e)},c=()=>{const e=[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>-1!=decodeURIComponent(n.$route.fullPath).indexOf(decodeURIComponent(e.hash)));null==e||e.length<1||null==e[0].offsetTop||setTimeout((function(){window.scrollTo(0,e[0].offsetTop+160)}),100)},u=()=>{const e=document.getElementsByClassName("sidebar")[0];let t=document.getElementsByClassName("active sidebar-link")[1];if(null!=t&&null!=t&&null!=t.offsetTop||(t=document.getElementsByClassName("active sidebar-link")[0]),null==t||null==t||null==t.offsetTop)return;const n=e.clientHeight||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=t.offsetTop,s=t.offsetTop+t.offsetHeight,i=e.scrollTop;s<=n+i||(e.scrollTop=s+5-n);o>=i||(e.scrollTop=o-5)},p=e=>p(n.$route,e.regularPath);return a(),Object(o.e)(()=>{(()=>{const e=decodeURIComponent(n.$route.fullPath);if(!e||""==e)return;const t=[].slice.call(document.querySelectorAll(".sidebar-link"));for(let n=0;nu()),{openGroupIndex:i,refreshIndex:a,toggleGroup:e=>{n.openGroupIndex=e===n.openGroupIndex?-1:e},isActive:p}},watch:{$route(){this.refreshIndex()}}}),c=n(2),u=Object(c.a)(a,(function(){var e=this,t=e._self._c;e._self._setupProxy;return e.items.length?t("ul",{staticClass:"sidebar-links"},e._l(e.items,(function(n,o){return t("li",{key:o},["group"===n.type?t("SidebarGroup",{attrs:{item:n,open:o===e.openGroupIndex,collapsable:n.collapsable||n.collapsible,depth:e.depth},on:{toggle:function(t){return e.toggleGroup(o)}}}):t("SidebarLink",{attrs:{sidebarDepth:e.sidebarDepth,item:n}})],1)})),0):e._e()}),[],!1,null,null,null);t.default=u.exports},383:function(e,t,n){"use strict";n.r(t);var o=n(0),s=n(17);var i=Object(o.c)({functional:!0,props:["item","sidebarDepth"],render(e,{parent:{$page:t,$site:n,$route:o,$themeConfig:i,$themeLocaleConfig:l},props:{item:r,sidebarDepth:a}}){const c=Object(s.e)(o,r.path),u="auto"===r.type?c||r.children.some(e=>Object(s.e)(o,r.basePath+"#"+e.slug)):c;return function(e,t,n,o){return e("router-link",{props:{to:t,activeClass:"",exactActiveClass:""},class:{active:o,"sidebar-link":!0}},n)}(e,r.path,r.title||r.path,u)}}),l=(n(374),n(2)),r=Object(l.a)(i,void 0,void 0,!1,null,null,null);t.default=r.exports},389:function(e,t,n){"use strict";n(369)},401:function(e,t,n){"use strict";n.r(t);var o=n(0),s=n(17),i=n(357),l=n(344),r=Object(o.c)({name:"SidebarGroup",props:["item","open","collapsable","depth"],components:{DropdownTransition:i.default},setup:(e,t)=>(Object(l.a)().$options.components.SidebarLinks=n(379).default,{isActive:s.e})}),a=(n(389),n(2)),c=Object(a.a)(r,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("section",{staticClass:"sidebar-group",class:[{collapsable:e.collapsable,"is-sub-group":0!==e.depth},"depth-"+e.depth]},[e.item.path?t("router-link",{staticClass:"sidebar-heading clickable",class:{open:e.open,active:e.isActive(e.$route,e.item.path)},attrs:{to:e.item.path},nativeOn:{click:function(t){return e.$emit("toggle")}}},[t("span",[e._v(e._s(e.item.title))]),e._v(" "),e.collapsable?t("span",{staticClass:"arrow",class:e.open?"down":"right"}):e._e()]):t("p",{staticClass:"sidebar-heading",class:{open:e.open},on:{click:function(t){return e.$emit("toggle")}}},[t("span",[e._v(e._s(e.item.title))]),e._v(" "),e.collapsable?t("span",{staticClass:"arrow",class:e.open?"down":"right"}):e._e()]),e._v(" "),t("DropdownTransition",[e.open||!e.collapsable?t("SidebarLinks",{staticClass:"sidebar-group-items",attrs:{items:e.item.children,sidebarDepth:e.item.sidebarDepth,depth:e.depth+1}}):e._e()],1)],1)}),[],!1,null,null,null);t.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/9.ae24e55d.js b/assets/js/9.ae24e55d.js new file mode 100644 index 0000000..7998576 --- /dev/null +++ b/assets/js/9.ae24e55d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{344:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return r}));n(134);var o=n(0);function c(){const e=Object(o.d)();if(!e)throw new Error("must be called in setup");return(null==e?void 0:e.proxy)||{}}function r(){const e=Object(o.h)(!1);return Object(o.e)(()=>{e.value=!0}),Object(o.f)(()=>{e.value=!1,setTimeout(()=>{e.value=!0},100)}),{recoShowModule:e}}},355:function(e,t,n){},366:function(e,t,n){"use strict";n(355)},421:function(e,t,n){},449:function(e,t,n){"use strict";n(421)},481:function(e,t,n){"use strict";n.r(t);var o=n(0),c=n(344);const r=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."];var s=Object(o.c)({setup(e,t){const n=Object(c.a)(),s=Object(o.a)(()=>!1!==n.$themeConfig.noFoundPageByTencent);return Object(o.e)(()=>{if(s.value){const e=document.createElement("script");e.setAttribute("homePageName","回到首页"),e.setAttribute("homePageUrl",n.$site.base),e.setAttribute("src","//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js"),document.body.append(e)}}),{noFoundPageByTencent:s,getMsg:()=>r[Math.floor(Math.random()*r.length)]}}}),u=(n(366),n(449),n(2)),i=Object(u.a)(s,(function(){var e=this,t=e._self._c;e._self._setupProxy;return e.noFoundPageByTencent?e._e():t("section",{staticClass:"theme-container"},[t("article",{staticClass:"content"},[t("h1",[e._v("404")]),e._v(" "),t("blockquote",[e._v(e._s(e.getMsg()))]),e._v(" "),t("router-link",{attrs:{to:"/"}},[e._v("Take me home.")])],1)])}),[],!1,null,null,null);t.default=i.exports}}]); \ No newline at end of file diff --git a/assets/js/app.96c5c25c.js b/assets/js/app.96c5c25c.js new file mode 100644 index 0000000..f5238d0 --- /dev/null +++ b/assets/js/app.96c5c25c.js @@ -0,0 +1,70 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(e){function t(t){for(var r,a,s=t[0],u=t[1],c=t[2],p=0,f=[];p=0&&Math.floor(t)===t&&isFinite(e)}function v(e){return a(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function m(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===p?JSON.stringify(e,g,2):String(e)}function g(e,t){return t&&t.__v_isRef?t.value:t}function y(e){var t=parseFloat(e);return isNaN(t)?e:t}function b(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(r,1)}}var x=Object.prototype.hasOwnProperty;function k(e,t){return x.call(e,t)}function C(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var D=/-(\w)/g,A=C((function(e){return e.replace(D,(function(e,t){return t?t.toUpperCase():""}))})),E=C((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),$=/\B([A-Z])/g,S=C((function(e){return e.replace($,"-$1").toLowerCase()}));var O=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function F(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function j(e,t){for(var n in t)e[n]=t[n];return e}function P(e){for(var t={},n=0;n0,Z=Y&&Y.indexOf("edge/")>0;Y&&Y.indexOf("android");var ee=Y&&/iphone|ipad|ipod|ios/.test(Y);Y&&/chrome\/\d+/.test(Y),Y&&/phantomjs/.test(Y);var te,ne=Y&&Y.match(/firefox\/(\d+)/),re={}.watch,oe=!1;if(K)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){oe=!0}}),window.addEventListener("test-passive",null,ie)}catch(e){}var ae=function(){return void 0===te&&(te=!K&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),te},se=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ue(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,le="undefined"!=typeof Symbol&&ue(Symbol)&&"undefined"!=typeof Reflect&&ue(Reflect.ownKeys);ce="undefined"!=typeof Set&&ue(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var pe=null;function fe(){return pe&&{proxy:pe}}function de(e){void 0===e&&(e=null),e||pe&&pe._scope.off(),pe=e,e&&e._scope.on()}var he=function(){function e(e,t,n,r,o,i,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1}return Object.defineProperty(e.prototype,"child",{get:function(){return this.componentInstance},enumerable:!1,configurable:!0}),e}(),ve=function(e){void 0===e&&(e="");var t=new he;return t.text=e,t.isComment=!0,t};function me(e){return new he(void 0,void 0,void 0,String(e))}function ge(e){var t=new he(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}"function"==typeof SuppressedError&&SuppressedError;var ye=0,be=[],we=function(){function e(){this._pending=!1,this.id=ye++,this.subs=[]}return e.prototype.addSub=function(e){this.subs.push(e)},e.prototype.removeSub=function(e){this.subs[this.subs.indexOf(e)]=null,this._pending||(this._pending=!0,be.push(this))},e.prototype.depend=function(t){e.target&&e.target.addDep(this)},e.prototype.notify=function(e){var t=this.subs.filter((function(e){return e}));for(var n=0,r=t.length;n0&&(rt((c=e(c,"".concat(n||"","_").concat(r)))[0])&&rt(p)&&(f[l]=me(p.text+c[0].text),c.shift()),f.push.apply(f,c)):u(c)?rt(p)?f[l]=me(p.text+c):""!==c&&f.push(me(c)):rt(c)&&rt(p)?f[l]=me(p.text+c.text):(s(t._isVList)&&a(c.tag)&&i(c.key)&&a(n)&&(c.key="__vlist".concat(n,"_").concat(r,"__")),f.push(c)));return f}(e):void 0}function rt(e){return a(e)&&a(e.text)&&!1===e.isComment}function ot(e,t){var n,r,i,s,u=null;if(o(e)||"string"==typeof e)for(u=new Array(e.length),n=0,r=e.length;n0,s=t?!!t.$stable:!a,u=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(s&&o&&o!==r&&u===o.$key&&!a&&!o.$hasNormal)return o;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=kt(e,n,c,t[c]))}else i={};for(var l in n)l in i||(i[l]=Ct(n,l));return t&&Object.isExtensible(t)&&(t._normalized=i),W(i,"$stable",s),W(i,"$key",u),W(i,"$hasNormal",a),i}function kt(e,t,n,r){var i=function(){var t=pe;de(e);var n=arguments.length?r.apply(null,arguments):r({}),i=(n=n&&"object"==typeof n&&!o(n)?[n]:nt(n))&&n[0];return de(t),n&&(!i||1===n.length&&i.isComment&&!_t(i))?void 0:n};return r.proxy&&Object.defineProperty(t,n,{get:i,enumerable:!0,configurable:!0}),i}function Ct(e,t){return function(){return e[t]}}function Dt(e){return{get attrs(){if(!e._attrsProxy){var t=e._attrsProxy={};W(t,"_v_attr_proxy",!0),At(t,e.$attrs,r,e,"$attrs")}return e._attrsProxy},get listeners(){e._listenersProxy||At(e._listenersProxy={},e.$listeners,r,e,"$listeners");return e._listenersProxy},get slots(){return function(e){e._slotsProxy||$t(e._slotsProxy={},e.$scopedSlots);return e._slotsProxy}(e)},emit:O(e.$emit,e),expose:function(t){t&&Object.keys(t).forEach((function(n){return Ve(e,t,n)}))}}}function At(e,t,n,r,o){var i=!1;for(var a in t)a in e?t[a]!==n[a]&&(i=!0):(i=!0,Et(e,a,r,o));for(var a in e)a in t||(i=!0,delete e[a]);return i}function Et(e,t,n,r){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){return n[r][t]}})}function $t(e,t){for(var n in t)e[n]=t[n];for(var n in e)n in t||delete e[n]}var St=null;function Ot(e,t){return(e.__esModule||le&&"Module"===e[Symbol.toStringTag])&&(e=e.default),l(e)?t.extend(e):e}function Ft(e){if(o(e))for(var t=0;tdocument.createEvent("Event").timeStamp&&(bn=function(){return wn.now()})}var _n=function(e,t){if(e.post){if(!t.post)return 1}else if(t.post)return-1;return e.id-t.id};function xn(){var e,t;for(yn=bn(),mn=!0,fn.sort(_n),gn=0;gngn&&fn[n].id>e.id;)n--;fn.splice(n+1,0,e)}else fn.push(e);vn||(vn=!0,Wt(xn))}}function Cn(e,t){if(e){for(var n=Object.create(null),r=le?Reflect.ownKeys(e):Object.keys(e),o=0;o-1)if(i&&!k(o,"default"))a=!1;else if(""===a||a===S(e)){var u=Wn(String,o.type);(u<0||s-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!d(e)&&e.test(t)}function sr(e,t){var n=e.cache,r=e.keys,o=e._vnode,i=e.$vnode;for(var a in n){var s=n[a];if(s){var u=s.name;u&&!t(u)&&ur(n,a,r,o)}}i.componentOptions.children=void 0}function ur(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,_(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=tr++,t._isVue=!0,t.__v_skip=!0,t._scope=new Ke(!0),t._scope.parent=void 0,t._scope._vm=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=zn(nr(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._provided=n?n._provided:Object.create(null),e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&an(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=bt(t._renderChildren,o),e.$scopedSlots=n?xt(e.$parent,n.data.scopedSlots,e.$slots):r,e._c=function(t,n,r,o){return jt(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return jt(e,t,n,r,o,!0)};var i=n&&n.data;Pe(e,"$attrs",i&&i.attrs||r,null,!0),Pe(e,"$listeners",t._parentListeners||r,null,!0)}(t),pn(t,"beforeCreate",void 0,!1),function(e){var t=Cn(e.$options.inject,e);t&&(Se(!1),Object.keys(t).forEach((function(n){Pe(e,n,t[n])})),Se(!0))}(t),Kn(t),function(e){var t=e.$options.provide;if(t){var n=c(t)?t.call(e):t;if(!l(n))return;for(var r=Ye(e),o=le?Reflect.ownKeys(n):Object.keys(n),i=0;i1?F(n):n;for(var r=F(arguments,1),o='event handler for "'.concat(e,'"'),i=0,a=n.length;iparseInt(this.max)&&ur(e,t[0],t,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)ur(this.cache,e,this.keys)},mounted:function(){var e=this;this.cacheVNode(),this.$watch("include",(function(t){sr(e,(function(e){return ar(t,e)}))})),this.$watch("exclude",(function(t){sr(e,(function(e){return!ar(t,e)}))}))},updated:function(){this.cacheVNode()},render:function(){var e=this.$slots.default,t=Ft(e),n=t&&t.componentOptions;if(n){var r=ir(n),o=this.include,i=this.exclude;if(o&&(!r||!ar(o,r))||i&&r&&ar(i,r))return t;var a=this.cache,s=this.keys,u=null==t.key?n.Ctor.cid+(n.tag?"::".concat(n.tag):""):t.key;a[u]?(t.componentInstance=a[u].componentInstance,_(s,u),s.push(u)):(this.vnodeToCache=t,this.keyToCache=u),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return q}};Object.defineProperty(e,"config",t),e.util={warn:Pn,extend:j,mergeOptions:zn,defineReactive:Pe},e.set=Te,e.delete=Ie,e.nextTick=Wt,e.observable=function(e){return je(e),e},e.options=Object.create(null),U.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,j(e.options.components,lr),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=F(arguments,1);return n.unshift(this),c(e.install)?e.install.apply(e,n):c(e)&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=zn(this.options,e),this}}(e),or(e),function(e){U.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&c(n)&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(rr),Object.defineProperty(rr.prototype,"$isServer",{get:ae}),Object.defineProperty(rr.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(rr,"FunctionalRenderContext",{value:Dn}),rr.version="2.7.16";var pr=b("style,class"),fr=b("input,textarea,option,select,progress"),dr=b("contenteditable,draggable,spellcheck"),hr=b("events,caret,typing,plaintext-only"),vr=b("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),mr="http://www.w3.org/1999/xlink",gr=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},yr=function(e){return gr(e)?e.slice(6,e.length):""},br=function(e){return null==e||!1===e};function wr(e){for(var t=e.data,n=e,r=e;a(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(t=_r(r.data,t));for(;a(n=n.parent);)n&&n.data&&(t=_r(t,n.data));return function(e,t){if(a(e)||a(t))return xr(e,kr(t));return""}(t.staticClass,t.class)}function _r(e,t){return{staticClass:xr(e.staticClass,t.staticClass),class:a(e.class)?[e.class,t.class]:t.class}}function xr(e,t){return e?t?e+" "+t:e:t||""}function kr(e){return Array.isArray(e)?function(e){for(var t,n="",r=0,o=e.length;r-1?Qr(e,t,n):vr(t)?br(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):dr(t)?e.setAttribute(t,function(e,t){return br(t)||"false"===t?"false":"contenteditable"===e&&hr(t)?t:"true"}(t,n)):gr(t)?br(n)?e.removeAttributeNS(mr,yr(t)):e.setAttributeNS(mr,t,n):Qr(e,t,n)}function Qr(e,t,n){if(br(n))e.removeAttribute(t);else{if(J&&!X&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var Gr={create:Hr,update:Hr};function Kr(e,t){var n=t.elm,r=t.data,o=e.data;if(!(i(r.staticClass)&&i(r.class)&&(i(o)||i(o.staticClass)&&i(o.class)))){var s=wr(t),u=n._transitionClasses;a(u)&&(s=xr(s,kr(u))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Yr,Jr={create:Kr,update:Kr};function Xr(e,t,n){var r=Yr;return function o(){var i=t.apply(null,arguments);null!==i&&to(e,o,n,r)}}var Zr=Lt&&!(ne&&Number(ne[1])<=53);function eo(e,t,n,r){if(Zr){var o=yn,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=o||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Yr.addEventListener(e,t,oe?{capture:n,passive:r}:n)}function to(e,t,n,r){(r||Yr).removeEventListener(e,t._wrapper||t,n)}function no(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},r=e.data.on||{};Yr=t.elm||e.elm,function(e){if(a(e.__r)){var t=J?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}a(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),Ze(n,r,eo,to,Xr,t.context),Yr=void 0}}var ro,oo={create:no,update:no,destroy:function(e){return no(e,Tr)}};function io(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,r,o=t.elm,u=e.data.domProps||{},c=t.data.domProps||{};for(n in(a(c.__ob__)||s(c._v_attr_proxy))&&(c=t.data.domProps=j({},c)),u)n in c||(o[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),r===u[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var l=i(r)?"":String(r);ao(o,l)&&(o.value=l)}else if("innerHTML"===n&&Ar(o.tagName)&&i(o.innerHTML)){(ro=ro||document.createElement("div")).innerHTML="".concat(r,"");for(var p=ro.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;p.firstChild;)o.appendChild(p.firstChild)}else if(r!==u[n])try{o[n]=r}catch(e){}}}}function ao(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var n=e.value,r=e._vModifiers;if(a(r)){if(r.number)return y(n)!==y(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}(e,t))}var so={create:io,update:io},uo=C((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function co(e){var t=lo(e.style);return e.staticStyle?j(e.staticStyle,t):t}function lo(e){return Array.isArray(e)?P(e):"string"==typeof e?uo(e):e}var po,fo=/^--/,ho=/\s*!important$/,vo=function(e,t,n){if(fo.test(t))e.style.setProperty(t,n);else if(ho.test(n))e.style.setProperty(S(t),n.replace(ho,""),"important");else{var r=go(t);if(Array.isArray(n))for(var o=0,i=n.length;o-1?t.split(wo).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" ".concat(e.getAttribute("class")||""," ");n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function xo(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(wo).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" ".concat(e.getAttribute("class")||""," "),r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function ko(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&j(t,Co(e.name||"v")),j(t,e),t}return"string"==typeof e?Co(e):void 0}}var Co=C((function(e){return{enterClass:"".concat(e,"-enter"),enterToClass:"".concat(e,"-enter-to"),enterActiveClass:"".concat(e,"-enter-active"),leaveClass:"".concat(e,"-leave"),leaveToClass:"".concat(e,"-leave-to"),leaveActiveClass:"".concat(e,"-leave-active")}})),Do=K&&!X,Ao="transition",Eo="transitionend",$o="animation",So="animationend";Do&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ao="WebkitTransition",Eo="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&($o="WebkitAnimation",So="webkitAnimationEnd"));var Oo=K?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Fo(e){Oo((function(){Oo(e)}))}function jo(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),_o(e,t))}function Po(e,t){e._transitionClasses&&_(e._transitionClasses,t),xo(e,t)}function To(e,t,n){var r=Mo(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s="transition"===o?Eo:So,u=0,c=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++u>=a&&c()};setTimeout((function(){u0&&(n="transition",l=a,p=i.length):"animation"===t?c>0&&(n="animation",l=c,p=u.length):p=(n=(l=Math.max(a,c))>0?a>c?"transition":"animation":null)?"transition"===n?i.length:u.length:0,{type:n,timeout:l,propCount:p,hasTransform:"transition"===n&&Io.test(r[Ao+"Property"])}}function Ro(e,t){for(;e.length1}function qo(e,t){!0!==t.data.show&&Bo(t)}var Vo=function(e){var t,n,r={},c=e.modules,l=e.nodeOps;for(t=0;th?w(e,i(n[g+1])?null:n[g+1].elm,n,d,g,r):d>g&&x(t,p,h)}(p,v,g,n,c):a(g)?(a(e.text)&&l.setTextContent(p,""),w(p,null,g,0,g.length-1,n)):a(v)?x(v,0,v.length-1):a(e.text)&&l.setTextContent(p,""):e.text!==t.text&&l.setTextContent(p,t.text),a(h)&&a(d=h.hook)&&a(d=d.postpatch)&&d(e,t)}}}function A(e,t,n){if(s(n)&&a(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r-1,a.selected!==i&&(a.selected=i);else if(R(Ko(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}}function Go(e,t){return t.every((function(t){return!R(t,e)}))}function Ko(e){return"_value"in e?e._value:e.value}function Yo(e){e.target.composing=!0}function Jo(e){e.target.composing&&(e.target.composing=!1,Xo(e.target,"input"))}function Xo(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Zo(e){return!e.componentInstance||e.data&&e.data.transition?e:Zo(e.componentInstance._vnode)}var ei={model:Ho,show:{bind:function(e,t,n){var r=t.value,o=(n=Zo(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o?(n.data.show=!0,Bo(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Zo(n)).data&&n.data.transition?(n.data.show=!0,r?Bo(n,(function(){e.style.display=e.__vOriginalDisplay})):zo(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}}},ti={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ni(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ni(Ft(t.children)):e}function ri(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var r in o)t[A(r)]=o[r];return t}function oi(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var ii=function(e){return e.tag||_t(e)},ai=function(e){return"show"===e.name},si={name:"transition",props:ti,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(ii)).length){0;var r=this.mode;0;var o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var i=ni(o);if(!i)return o;if(this._leaving)return oi(e,o);var a="__transition-".concat(this._uid,"-");i.key=null==i.key?i.isComment?a+"comment":a+i.tag:u(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=ri(this),c=this._vnode,l=ni(c);if(i.data.directives&&i.data.directives.some(ai)&&(i.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(i,l)&&!_t(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var p=l.data.transition=j({},s);if("out-in"===r)return this._leaving=!0,et(p,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),oi(e,o);if("in-out"===r){if(_t(i))return c;var f,d=function(){f()};et(s,"afterEnter",d),et(s,"enterCancelled",d),et(p,"delayLeave",(function(e){f=e}))}}return o}}},ui=j({tag:String,moveClass:String},ti);function ci(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function li(e){e.data.newPos=e.elm.getBoundingClientRect()}function pi(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,o=t.top-n.top;if(r||o){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate(".concat(r,"px,").concat(o,"px)"),i.transitionDuration="0s"}}delete ui.mode;var fi={Transition:si,TransitionGroup:{props:ui,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var o=un(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,o(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=ri(this),s=0;s-1?$r[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:$r[e]=/HTMLUnknownElement/.test(t.toString())},j(rr.options.directives,ei),j(rr.options.components,fi),rr.prototype.__patch__=K?Vo:T,rr.prototype.$mount=function(e,t){return function(e,t,n){var r;e.$el=t,e.$options.render||(e.$options.render=ve),pn(e,"beforeMount"),r=function(){e._update(e._render(),n)},new tn(e,r,T,{before:function(){e._isMounted&&!e._isDestroyed&&pn(e,"beforeUpdate")}},!0),n=!1;var o=e._preWatchers;if(o)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};t.name=t.name||e._componentTag||e.name;var n=e.prototype;Object.getOwnPropertyNames(n).forEach((function(e){if("constructor"!==e)if(d.indexOf(e)>-1)t[e]=n[e];else{var r=Object.getOwnPropertyDescriptor(n,e);void 0!==r.value?"function"==typeof r.value?(t.methods||(t.methods={}))[e]=r.value:(t.mixins||(t.mixins=[])).push({data:function(){return i({},e,r.value)}}):(r.get||r.set)&&((t.computed||(t.computed={}))[e]={get:r.get,set:r.set})}})),(t.mixins||(t.mixins=[])).push({data:function(){return f(this,e)}});var o=e.__decorators__;o&&(o.forEach((function(e){return e(t)})),delete e.__decorators__);var a=Object.getPrototypeOf(e.prototype),c=a instanceof r.b?a.constructor:r.b,l=c.extend(t);return m(l,e,c),s()&&u(l,e),l}var v={prototype:!0,arguments:!0,callee:!0,caller:!0};function m(e,t,n){Object.getOwnPropertyNames(t).forEach((function(r){if(!v[r]){var i=Object.getOwnPropertyDescriptor(e,r);if(!i||i.configurable){var a,s,u=Object.getOwnPropertyDescriptor(t,r);if(!l){if("cid"===r)return;var c=Object.getOwnPropertyDescriptor(n,r);if(a=u.value,s=o(a),null!=a&&("object"===s||"function"===s)&&c&&c.value===u.value)return}0,Object.defineProperty(e,r,u)}}}))}function g(e){return"function"==typeof e?h(e):function(t){return h(t,e)}}g.registerHooks=function(e){d.push.apply(d,a(e))},t.b=g},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,s){var u,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=u):o&&(u=s?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(c.functional){c._injectStyles=u;var l=c.render;c.render=function(e,t){return u.call(t),l(e,t)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,u):[u]}return{exports:e,options:c}}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof global&&global)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},function(e,t,n){"use strict";var r=n(117),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function a(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n0&&($+=T)}return new Date(S+O+$)}return new Date(e)}},function(e,t,n){"use strict";var r=n(22),o=n(33),i=n(36),a=n(173),s=n(175);r({target:"Array",proto:!0,arity:1,forced:n(6)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=o(this),n=i(t),r=arguments.length;s(n+r);for(var u=0;ufunction e(t,n,r,o=1){if("string"==typeof t)return d(n,t,r);if(Array.isArray(t))return Object.assign(d(n,t[0],r),{title:t[1]});{o>3&&console.error("[vuepress] detected a too deep nested sidebar group.");const i=t.children||[];return 0===i.length&&t.path?Object.assign(d(n,t.path,r),{title:t.title}):{type:"group",path:t.path,title:t.title,sidebarDepth:t.sidebarDepth,children:i.map(t=>e(t,n,r,o+1)),collapsable:!1!==t.collapsable}}}(e,o,s)):[]}function v(e){return Object.assign(e,{type:e.items&&e.items.length?"links":"link"})}function m(e){return e?new Date(e).getTime():0}function g(e,t){const n=m(e.frontmatter.date),r=m(t.frontmatter.date);return 0===n||0===r?0:r-n}function y(e){const t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.append(t)}},function(e,t,n){"use strict";var r=n(8),o=n(81),i=n(83),a=n(34),s=n(71),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor;t.f=r?i?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var r=l(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=s(t),a(n),o)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";var r=n(287),o=n(288),i=n(289),a=n(290),s=n(112),u=n(26),c=n(291),l=Function,p=function(e){try{return l('"use strict"; return ('+e+").constructor;")()}catch(e){}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch(e){f=null}var d=function(){throw new u},h=f?function(){try{return d}catch(e){try{return f(arguments,"callee").get}catch(e){return d}}}():d,v=n(292)(),m=n(294)(),g=Object.getPrototypeOf||(m?function(e){return e.__proto__}:null),y={},b="undefined"!=typeof Uint8Array&&g?g(Uint8Array):void 0,w={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":v&&g?g([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":y,"%AsyncGenerator%":y,"%AsyncGeneratorFunction%":y,"%AsyncIteratorPrototype%":y,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":y,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":v&&g?g(g([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&v&&g?g((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&v&&g?g((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":v&&g?g(""[Symbol.iterator]()):void 0,"%Symbol%":v?Symbol:void 0,"%SyntaxError%":s,"%ThrowTypeError%":h,"%TypedArray%":b,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet};if(g)try{null.error}catch(e){var _=g(g(e));w["%Error.prototype%"]=_}var x={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},k=n(61),C=n(296),D=k.call(Function.call,Array.prototype.concat),A=k.call(Function.apply,Array.prototype.splice),E=k.call(Function.call,String.prototype.replace),$=k.call(Function.call,String.prototype.slice),S=k.call(Function.call,RegExp.prototype.exec),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,F=/\\(\\)?/g,j=function(e){var t=$(e,0,1),n=$(e,-1);if("%"===t&&"%"!==n)throw new s("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new s("invalid intrinsic syntax, expected opening `%`");var r=[];return E(e,O,(function(e,t,n,o){r[r.length]=n?E(o,F,"$1"):t||e})),r},P=function(e,t){var n,r=e;if(C(x,r)&&(r="%"+(n=x[r])[0]+"%"),C(w,r)){var o=w[r];if(o===y&&(o=function e(t){var n;if("%AsyncFunction%"===t)n=p("async function () {}");else if("%GeneratorFunction%"===t)n=p("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=p("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&g&&(n=g(o.prototype))}return w[t]=n,n}(r)),void 0===o&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new s("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,e))throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=j(e),r=n.length>0?n[0]:"",o=P("%"+r+"%",t),i=o.name,a=o.value,c=!1,l=o.alias;l&&(r=l[0],A(n,D([0,1],l)));for(var p=1,d=!0;p=n.length){var g=f(a,h);a=(d=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[h]}else d=C(a,h),a=a[h];d&&!c&&(w[i]=a)}}return a}},function(e,t,n){"use strict";var r=n(285),o=n(304),i=n(63);e.exports={formats:i,parse:o,stringify:r}},function(e,t,n){"use strict";var r=n(3),o=n(68).f,i=n(23),a=n(135),s=n(49),u=n(85),c=n(154);e.exports=function(e,t){var n,l,p,f,d,h=e.target,v=e.global,m=e.stat;if(n=v?r:m?r[h]||s(h,{}):r[h]&&r[h].prototype)for(l in t){if(f=t[l],p=e.dontCallGetSet?(d=o(n,l))&&d.value:n[l],!c(v?l:h+(m?".":"#")+l,e.forced)&&void 0!==p){if(typeof f==typeof p)continue;u(f,p)}(e.sham||p&&p.sham)&&i(f,"sham",!0),a(n,l,f,e)}}},function(e,t,n){"use strict";var r=n(8),o=n(18),i=n(46);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(11).Symbol;e.exports=r},function(e,t,n){var r=n(24),o=n(179),i=n(180),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},function(e,t,n){"use strict";e.exports=TypeError},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return a}));var r=n(17);function o(e,t){return e=e.filter((n,r)=>{const{title:o,frontmatter:{home:i,date:a,publish:s}}=n;if(e.indexOf(n)!==r)return!1;{const e=!0===i||null==o||!1===s;return!0===t?!(e||void 0===a):!e}})}function i(e){e.sort((e,t)=>{const n=e.frontmatter.sticky,o=t.frontmatter.sticky;return n&&o?n==o?Object(r.b)(e,t):n-o:n&&!o?-1:!n&&o?1:Object(r.b)(e,t)})}function a(e){e.sort((e,t)=>Object(r.b)(e,t))}},function(e,t,n){"use strict";var r=n(3),o=n(78),i=n(13),a=n(80),s=n(75),u=n(74),c=r.Symbol,l=o("wks"),p=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return i(l,e)||(l[e]=s&&i(c,e)?c[e]:p("Symbol."+e)),l[e]}},function(e,t,n){"use strict";var r=n(69),o=n(31);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";var r=n(5),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},function(e,t,n){"use strict";var r=n(70),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(3),o=n(7),i=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e]):r[e]&&r[e][t]}},function(e,t,n){"use strict";var r=n(31),o=Object;e.exports=function(e){return o(r(e))}},function(e,t,n){"use strict";var r=n(10),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not an object")}},function(e,t,n){"use strict";var r=n(151);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},function(e,t,n){"use strict";var r=n(152);e.exports=function(e){return r(e.length)}},function(e,t,n){var r=n(184),o=n(185),i=n(186),a=n(187),s=n(188);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t
'};function o(e,t,n){return en?n:e}function i(e){return 100*(-1+e)}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=o(e,r.minimum,1),n.status=1===e?null:e;var u=n.render(!t),c=u.querySelector(r.barSelector),l=r.speed,p=r.easing;return u.offsetWidth,a((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,function(e,t,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+i(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+i(e)+"%,0)"}:{"margin-left":i(e)+"%"}).transition="all "+t+"ms "+n,o}(e,l,p)),1===e?(s(u,{transition:"none",opacity:1}),u.offsetWidth,setTimeout((function(){s(u,{transition:"all "+l+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),l)}),l)):setTimeout(t,l)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var o,a=t.querySelector(r.barSelector),u=e?"-100":i(n.status||0),l=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),r.showSpinner||(o=t.querySelector(r.spinnerSelector))&&f(o),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},n.remove=function(){l(document.documentElement,"nprogress-busy"),l(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var a=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n){return n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()})),t[n]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var r,o=e.length,i=t.charAt(0).toUpperCase()+t.slice(1);o--;)if((r=e[o]+i)in n)return r;return t}(n))}function r(e,t,r){t=n(t),e.style[t]=r}return function(e,t){var n,o,i=arguments;if(2==i.length)for(n in t)void 0!==(o=t[n])&&t.hasOwnProperty(n)&&r(e,n,o);else r(e,i[1],i[2])}}();function u(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=p(e),r=n+t;u(n,t)||(e.className=r.substring(1))}function l(e,t){var n,r=p(e);u(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n})?r.call(t,n,t,e):r)||(e.exports=o)},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i}));n(16),n(17);function r(){const e=["#e15b64","#f47e60","#f8b26a","#abbd81","#849b87","#e15b64","#f47e60","#f8b26a","#f26d6d","#67cc86","#fb9b5f","#3498db"];return e[Math.floor(Math.random()*e.length)]}function o(e){const t=e.__proto__.push;e.__proto__.push=function(e){return t.call(this,e).catch(e=>e)}}function i(e){const t=e.getRoutes();e.beforeEach((e,n,r)=>{const o=t.find(t=>t.regex.test(e.path));return/\.html$/.test(e.path)||o&&"*"!==o.path&&!o.redirect?r():decodeURIComponent(e.path)!==e.path?r(Object.assign({},e,{path:decodeURIComponent(e.path),fullPath:decodeURIComponent(e.fullPath)})):void r()})}},function(e,t,n){"use strict";var r=n(45),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},function(e,t,n){"use strict";var r=n(6);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},function(e,t,n){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var r=n(7),o=n(141),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not a function")}},function(e,t,n){"use strict";var r=n(79),o=n(3),i=n(49),a=e.exports=o["__core-js_shared__"]||i("__core-js_shared__",{});(a.versions||(a.versions=[])).push({version:"3.38.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(e,t,n){"use strict";var r=n(3),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,n){var r=n(178),o=n(19),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},function(e,t,n){var r=n(14)(n(11),"Map");e.exports=r},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var r=n(198),o=n(205),i=n(207),a=n(208),s=n(209);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){var r=n(12),o=n(59),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(a.test(e)||!i.test(e)||null!=t&&e in Object(t))}},function(e,t,n){var r=n(25),o=n(19);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},function(e,t){e.exports=function(e){return e}},function(e,t,n){"use strict";var r=n(295);e.exports=Function.prototype.bind||r},function(e,t,n){"use strict";var r=n(20)("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch(e){r=!1}e.exports=r},function(e,t,n){"use strict";var r=String.prototype.replace,o=/%20/g,i="RFC1738",a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return r.call(e,o,"+")},RFC3986:function(e){return String(e)}},RFC1738:i,RFC3986:a}},function(e,t,n){var r=n(311);e.exports=function(e){return r(e,{weekStartsOn:1})}},function(e,t,n){"use strict";var r=n(4),o=n(323),i=n(119),a={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=n(120)),u),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(s(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,a=!n&&"json"===this.responseType;if(a||o&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(a){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(a)})),e.exports=c},function(e,t,n){"use strict";var r=n(167),o=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return o(e)}},function(e,t,n){"use strict";var r=n(22),o=n(155).left,i=n(156),a=n(76);r({target:"Array",proto:!0,forced:!n(157)&&a>79&&a<83||!i("reduce")},{reduce:function(e){var t=arguments.length;return o(this,e,t,t>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(8),o=n(44),i=n(138),a=n(46),s=n(29),u=n(71),c=n(13),l=n(81),p=Object.getOwnPropertyDescriptor;t.f=r?p:function(e,t){if(e=s(e),t=u(t),l)try{return p(e,t)}catch(e){}if(c(e,t))return a(!o(i.f,e,t),e[t])}},function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(30),a=Object,s=r("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===i(e)?s(e,""):a(e)}:a},function(e,t,n){"use strict";e.exports=function(e){return null==e}},function(e,t,n){"use strict";var r=n(139),o=n(72);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},function(e,t,n){"use strict";var r=n(32),o=n(7),i=n(73),a=n(74),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,s(e))}},function(e,t,n){"use strict";var r=n(5);e.exports=r({}.isPrototypeOf)},function(e,t,n){"use strict";var r=n(75);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){"use strict";var r=n(76),o=n(6),i=n(3).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},function(e,t,n){"use strict";var r,o,i=n(3),a=n(77),s=i.process,u=i.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(o=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},function(e,t,n){"use strict";var r=n(3).navigator,o=r&&r.userAgent;e.exports=o?String(o):""},function(e,t,n){"use strict";var r=n(48);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},function(e,t,n){"use strict";e.exports=!1},function(e,t,n){"use strict";var r=n(5),o=0,i=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+i,36)}},function(e,t,n){"use strict";var r=n(8),o=n(6),i=n(82);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){"use strict";var r=n(3),o=n(10),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){"use strict";var r=n(8),o=n(6);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(e,t,n){"use strict";var r=n(78),o=n(80),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},function(e,t,n){"use strict";var r=n(13),o=n(147),i=n(68),a=n(18);e.exports=function(e,t,n){for(var s=o(t),u=a.f,c=i.f,l=0;lc;)o(r,n=t[c++])&&(~a(l,n)||u(l,n));return l}},function(e,t,n){"use strict";var r=n(161),o=n(10),i=n(31),a=n(162);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return i(n),a(r),o(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++nl))return!1;var f=u.get(e),d=u.get(t);if(f&&d)return f==t&&d==e;var h=-1,v=!0,m=2&n?new r:void 0;for(u.set(e,t),u.set(t,e);++h-1&&e%1==0&&e1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],o=0;o=1024?s.slice(c,c+1024):s,p=[],f=0;f=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===r.RFC1738&&(40===d||41===d)?p[p.length]=l.charAt(f):d<128?p[p.length]=a[d]:d<2048?p[p.length]=a[192|d>>6]+a[128|63&d]:d<55296||d>=57344?p[p.length]=a[224|d>>12]+a[128|d>>6&63]+a[128|63&d]:(f+=1,d=65536+((1023&d)<<10|1023&l.charCodeAt(f)),p[p.length]=a[240|d>>18]+a[128|d>>12&63]+a[128|d>>6&63]+a[128|63&d])}u+=p.join("")}return u},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var n=[],r=0;r=a.getTime()?n+1:t.getTime()>=u.getTime()?n:n-1}},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r]/;e.exports=function(e){var t,n=""+e,o=r.exec(n);if(!o)return n;var i="",a=0,s=0;for(a=o.index;a=t||n<0||m&&e-c>=i}function _(){var e=d();if(w(e))return x(e);s=setTimeout(_,function(e){var n=t-(e-u);return m?f(n,i-(e-c)):n}(e))}function x(e){return s=void 0,g&&r?y(e):(r=o=void 0,a)}function k(){var e=d(),n=w(e);if(r=arguments,o=this,u=e,n){if(void 0===s)return b(u);if(m)return s=setTimeout(_,t),y(u)}return void 0===s&&(s=setTimeout(_,t)),a}return t=v(t)||0,h(n)&&(l=!!n.leading,i=(m="maxWait"in n)?p(v(n.maxWait)||0,t):i,g="trailing"in n?!!n.trailing:g),k.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=u=o=s=void 0},k.flush=function(){return void 0===s?a:x(d())},k}},function(e,t,n){!function(){"use strict";e.exports={polyfill:function(){var e=window,t=document;if(!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var n,r=e.HTMLElement||e.Element,o={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||s,scrollIntoView:r.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,a=(n=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(n)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?h.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):o.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(u(arguments[0])?o.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},r.prototype.scroll=r.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==u(arguments[0])){var e=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");o.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},r.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):o.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},r.prototype.scrollIntoView=function(){if(!0!==u(arguments[0])){var n=f(this),r=n.getBoundingClientRect(),i=this.getBoundingClientRect();n!==t.body?(h.call(this,n,n.scrollLeft+i.left-r.left,n.scrollTop+i.top-r.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:r.left,top:r.top,behavior:"smooth"})):e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})}else o.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function s(e,t){this.scrollLeft=e,this.scrollTop=t}function u(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+a1?1:s,n=.5*(1-Math.cos(Math.PI*a)),r=t.startX+(t.x-t.startX)*n,o=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,o),r===t.x&&o===t.y||e.requestAnimationFrame(d.bind(e,t))}function h(n,r,a){var u,c,l,p,f=i();n===t.body?(u=e,c=e.scrollX||e.pageXOffset,l=e.scrollY||e.pageYOffset,p=o.scroll):(u=n,c=n.scrollLeft,l=n.scrollTop,p=s),d({scrollable:u,method:p,startTime:f,startX:c,startY:l,x:r,y:a})}}}}()},function(e,t,n){var r=n(305),o=n(310),i=n(116),a=n(15),s=n(313),u=n(314);var c={M:function(e){return e.getMonth()+1},MM:function(e){return f(e.getMonth()+1,2)},Q:function(e){return Math.ceil((e.getMonth()+1)/3)},D:function(e){return e.getDate()},DD:function(e){return f(e.getDate(),2)},DDD:function(e){return r(e)},DDDD:function(e){return f(r(e),3)},d:function(e){return e.getDay()},E:function(e){return e.getDay()||7},W:function(e){return o(e)},WW:function(e){return f(o(e),2)},YY:function(e){return f(e.getFullYear(),4).substr(2)},YYYY:function(e){return f(e.getFullYear(),4)},GG:function(e){return String(i(e)).substr(2)},GGGG:function(e){return i(e)},H:function(e){return e.getHours()},HH:function(e){return f(e.getHours(),2)},h:function(e){var t=e.getHours();return 0===t?12:t>12?t%12:t},hh:function(e){return f(c.h(e),2)},m:function(e){return e.getMinutes()},mm:function(e){return f(e.getMinutes(),2)},s:function(e){return e.getSeconds()},ss:function(e){return f(e.getSeconds(),2)},S:function(e){return Math.floor(e.getMilliseconds()/100)},SS:function(e){return f(Math.floor(e.getMilliseconds()/10),2)},SSS:function(e){return f(e.getMilliseconds(),3)},Z:function(e){return p(e.getTimezoneOffset(),":")},ZZ:function(e){return p(e.getTimezoneOffset())},X:function(e){return Math.floor(e.getTime()/1e3)},x:function(e){return e.getTime()}};function l(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|]$/g,""):e.replace(/\\/g,"")}function p(e,t){t=t||"";var n=e>0?"-":"+",r=Math.abs(e),o=r%60;return n+f(Math.floor(r/60),2)+t+f(o,2)}function f(e,t){for(var n=Math.abs(e).toString();n.length=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(339)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},function(e,t,n){"use strict";var r=n(22),o=n(3),i=n(159),a=n(160),s=o.WebAssembly,u=7!==new Error("e",{cause:7}).cause,c=function(e,t){var n={};n[e]=a(e,t,u),r({global:!0,constructor:!0,arity:1,forced:u},n)},l=function(e,t){if(s&&s[e]){var n={};n[e]=a("WebAssembly."+e,t,u),r({target:"WebAssembly",stat:!0,constructor:!0,arity:1,forced:u},n)}};c("Error",(function(e){return function(t){return i(e,this,arguments)}})),c("EvalError",(function(e){return function(t){return i(e,this,arguments)}})),c("RangeError",(function(e){return function(t){return i(e,this,arguments)}})),c("ReferenceError",(function(e){return function(t){return i(e,this,arguments)}})),c("SyntaxError",(function(e){return function(t){return i(e,this,arguments)}})),c("TypeError",(function(e){return function(t){return i(e,this,arguments)}})),c("URIError",(function(e){return function(t){return i(e,this,arguments)}})),l("CompileError",(function(e){return function(t){return i(e,this,arguments)}})),l("LinkError",(function(e){return function(t){return i(e,this,arguments)}})),l("RuntimeError",(function(e){return function(t){return i(e,this,arguments)}}))},function(e,t,n){"use strict";var r=n(7),o=n(18),i=n(136),a=n(49);e.exports=function(e,t,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(r(n)&&i(n,c,s),s.global)u?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=n:o.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(7),a=n(13),s=n(8),u=n(143).CONFIGURABLE,c=n(144),l=n(145),p=l.enforce,f=l.get,d=String,h=Object.defineProperty,v=r("".slice),m=r("".replace),g=r([].join),y=s&&!o((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),w=e.exports=function(e,t,n){"Symbol("===v(d(t),0,7)&&(t="["+m(d(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),y&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=p(e);return a(r,"source")||(r.source=g(b,"string"==typeof t?t:"")),e};Function.prototype.toString=w((function(){return i(this)&&f(this).source||c(this)}),"toString")},function(e,t,n){e.exports=n(343)},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){"use strict";var r=n(44),o=n(10),i=n(72),a=n(140),s=n(142),u=n(28),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var n,u=a(e,l);if(u){if(void 0===t&&(t="default"),n=r(u,e,t),!o(n)||i(n))return n;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},function(e,t,n){"use strict";var r=n(47),o=n(70);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},function(e,t,n){"use strict";var r=String;e.exports=function(e){try{return r(e)}catch(e){return"Object"}}},function(e,t,n){"use strict";var r=n(44),o=n(7),i=n(10),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&o(n=e.toString)&&!i(s=r(n,e)))return s;if(o(n=e.valueOf)&&!i(s=r(n,e)))return s;if("string"!==t&&o(n=e.toString)&&!i(s=r(n,e)))return s;throw new a("Can't convert object to primitive value")}},function(e,t,n){"use strict";var r=n(8),o=n(13),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=o(i,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(i,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},function(e,t,n){"use strict";var r=n(5),o=n(7),i=n(48),a=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource},function(e,t,n){"use strict";var r,o,i,a=n(146),s=n(3),u=n(10),c=n(23),l=n(13),p=n(48),f=n(84),d=n(50),h=s.TypeError,v=s.WeakMap;if(a||p.state){var m=p.state||(p.state=new v);m.get=m.get,m.has=m.has,m.set=m.set,r=function(e,t){if(m.has(e))throw new h("Object already initialized");return t.facade=e,m.set(e,t),t},o=function(e){return m.get(e)||{}},i=function(e){return m.has(e)}}else{var g=f("state");d[g]=!0,r=function(e,t){if(l(e,g))throw new h("Object already initialized");return t.facade=e,c(e,g,t),t},o=function(e){return l(e,g)?e[g]:{}},i=function(e){return l(e,g)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!u(t)||(n=o(t)).type!==e)throw new h("Incompatible receiver, "+e+" required");return n}}}},function(e,t,n){"use strict";var r=n(3),o=n(7),i=r.WeakMap;e.exports=o(i)&&/native code/.test(String(i))},function(e,t,n){"use strict";var r=n(32),o=n(5),i=n(148),a=n(153),s=n(34),u=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(s(e)),n=a.f;return n?u(t,n(e)):t}},function(e,t,n){"use strict";var r=n(86),o=n(51).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){"use strict";var r=n(29),o=n(150),i=n(36),a=function(e){return function(t,n,a){var s=r(t),u=i(s);if(0===u)return!e&&-1;var c,l=o(a,u);if(e&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){"use strict";var r=n(35),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t,n){"use strict";var r=Math.ceil,o=Math.floor;e.exports=Math.trunc||function(e){var t=+e;return(t>0?o:r)(t)}},function(e,t,n){"use strict";var r=n(35),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},function(e,t,n){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,n){"use strict";var r=n(6),o=n(7),i=/#|\.prototype\./,a=function(e,t){var n=u[s(e)];return n===l||n!==c&&(o(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},function(e,t,n){"use strict";var r=n(47),o=n(33),i=n(69),a=n(36),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,n,c,l){var p=o(t),f=i(p),d=a(p);if(r(n),0===d&&c<2)throw new s(u);var h=e?d-1:0,v=e?-1:1;if(c<2)for(;;){if(h in f){l=f[h],h+=v;break}if(h+=v,e?h<0:d<=h)throw new s(u)}for(;e?h>=0:d>h;h+=v)h in f&&(l=n(l,f[h],h,p));return l}};e.exports={left:c(!1),right:c(!0)}},function(e,t,n){"use strict";var r=n(6);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},function(e,t,n){"use strict";var r=n(158);e.exports="NODE"===r},function(e,t,n){"use strict";var r=n(3),o=n(77),i=n(30),a=function(e){return o.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},function(e,t,n){"use strict";var r=n(45),o=Function.prototype,i=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(i):function(){return a.apply(i,arguments)})},function(e,t,n){"use strict";var r=n(32),o=n(13),i=n(23),a=n(73),s=n(87),u=n(85),c=n(164),l=n(165),p=n(166),f=n(169),d=n(170),h=n(8),v=n(79);e.exports=function(e,t,n,m){var g=m?2:1,y=e.split("."),b=y[y.length-1],w=r.apply(null,y);if(w){var _=w.prototype;if(!v&&o(_,"cause")&&delete _.cause,!n)return w;var x=r("Error"),k=t((function(e,t){var n=p(m?t:e,void 0),r=m?new w(e):new w;return void 0!==n&&i(r,"message",n),d(r,k,r.stack,2),this&&a(_,this)&&l(r,this,k),arguments.length>g&&f(r,arguments[g]),r}));if(k.prototype=_,"Error"!==b?s?s(k,x):u(k,x,{name:!0}):h&&"stackTraceLimit"in w&&(c(k,w,"stackTraceLimit"),c(k,w,"prepareStackTrace")),u(k,w),!v)try{_.name!==b&&i(_,"name",b),_.constructor=k}catch(e){}return k}}},function(e,t,n){"use strict";var r=n(5),o=n(47);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},function(e,t,n){"use strict";var r=n(163),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i("Can't set "+o(e)+" as a prototype")}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e){return r(e)||null===e}},function(e,t,n){"use strict";var r=n(18).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},function(e,t,n){"use strict";var r=n(7),o=n(10),i=n(87);e.exports=function(e,t,n){var a,s;return i&&r(a=t.constructor)&&a!==n&&o(s=a.prototype)&&s!==n.prototype&&i(e,s),e}},function(e,t,n){"use strict";var r=n(66);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},function(e,t,n){"use strict";var r=n(168),o=n(7),i=n(30),a=n(28)("toStringTag"),s=Object,u="Arguments"===i(function(){return arguments}());e.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:u?i(t):"Object"===(r=i(t))&&o(t.callee)?"Arguments":r}},function(e,t,n){"use strict";var r={};r[n(28)("toStringTag")]="z",e.exports="[object z]"===String(r)},function(e,t,n){"use strict";var r=n(10),o=n(23);e.exports=function(e,t){r(t)&&"cause"in t&&o(e,"cause",t.cause)}},function(e,t,n){"use strict";var r=n(23),o=n(171),i=n(172),a=Error.captureStackTrace;e.exports=function(e,t,n,s){i&&(a?a(e,t):r(e,"stack",o(n,s)))}},function(e,t,n){"use strict";var r=n(5),o=Error,i=r("".replace),a=String(new o("zxcasd").stack),s=/\n\s*at [^:]*:[^\n]*/,u=s.test(a);e.exports=function(e,t){if(u&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=i(e,s,"");return e}},function(e,t,n){"use strict";var r=n(6),o=n(46);e.exports=!r((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)}))},function(e,t,n){"use strict";var r=n(8),o=n(174),i=TypeError,a=Object.getOwnPropertyDescriptor,s=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=s?function(e,t){if(o(e)&&!a(e,"length").writable)throw new i("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},function(e,t,n){"use strict";var r=n(30);e.exports=Array.isArray||function(e){return"Array"===r(e)}},function(e,t,n){"use strict";var r=TypeError;e.exports=function(e){if(e>9007199254740991)throw r("Maximum allowed index exceeded");return e}},function(e,t,n){var r=n(88),o=n(177);e.exports=function e(t,n,i,a,s){var u=-1,c=t.length;for(i||(i=o),s||(s=[]);++u0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},function(e,t,n){var r=n(24),o=n(52),i=n(12),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},function(e,t,n){var r=n(25),o=n(19);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},function(e,t,n){var r=n(24),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[s]=n:delete e[s]),o}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r=n(182),o=n(238),i=n(60),a=n(12),s=n(249);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},function(e,t,n){var r=n(183),o=n(237),i=n(106);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(90),o=n(94);e.exports=function(e,t,n,i){var a=n.length,s=a,u=!i;if(null==e)return!s;for(e=Object(e);a--;){var c=n[a];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a-1}},function(e,t,n){var r=n(38);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},function(e,t,n){var r=n(37);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(37),o=n(53),i=n(55);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(92),o=n(195),i=n(54),a=n(93),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,p=c.hasOwnProperty,f=RegExp("^"+l.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:s).test(a(e))}},function(e,t,n){var r,o=n(196),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},function(e,t,n){var r=n(11)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(199),o=n(37),i=n(53);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},function(e,t,n){var r=n(200),o=n(201),i=n(202),a=n(203),s=n(204);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(96),o=n(261),i=n(266),a=n(97),s=n(267),u=n(56);e.exports=function(e,t,n){var c=-1,l=o,p=e.length,f=!0,d=[],h=d;if(n)f=!1,l=i;else if(p>=200){var v=t?null:s(e);if(v)return u(v);f=!1,l=a,h=new r}else h=t?[]:d;e:for(;++c-1}},function(e,t,n){var r=n(263),o=n(264),i=n(265);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},function(e,t){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i=0?r:n+r;return s<0||s>=n?void 0:t[s]}}),s("at")},function(e,t,n){"use strict";var r=n(28),o=n(277),i=n(18).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&i(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o=n(34),i=n(278),a=n(51),s=n(50),u=n(280),c=n(82),l=n(84),p=l("IE_PROTO"),f=function(){},d=function(e){return" + + diff --git a/flutter/index.html b/flutter/index.html new file mode 100644 index 0000000..1a2f648 --- /dev/null +++ b/flutter/index.html @@ -0,0 +1,38 @@ + + + + + + Flutter | 点滴记录 + + + + + + + + +

Flutter

# Flutter

Last Updated: 6/25/2022, 5:25:39 PM
    + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..2efd79b --- /dev/null +++ b/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

    记录开发中点点滴滴

    Last Updated: 6/25/2022, 5:25:39 PM
      + + + diff --git a/nodejs/index.html b/nodejs/index.html new file mode 100644 index 0000000..d09a6a8 --- /dev/null +++ b/nodejs/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

      nodejs

      Last Updated: 6/25/2022, 5:25:39 PM
        + + + diff --git a/nuxt/index.html b/nuxt/index.html new file mode 100644 index 0000000..817370b --- /dev/null +++ b/nuxt/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

        Nuxt

        Last Updated: 6/25/2022, 5:25:39 PM
          + + + diff --git a/react/index.html b/react/index.html new file mode 100644 index 0000000..ecbd026 --- /dev/null +++ b/react/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

          Nuxt

          Last Updated: 7/22/2024, 3:01:01 PM
            + + + diff --git a/tag/index.html b/tag/index.html new file mode 100644 index 0000000..e18e4b0 --- /dev/null +++ b/tag/index.html @@ -0,0 +1,38 @@ + + + + + + Tags | 点滴记录 + + + + + + + + + + + + diff --git a/timeline/index.html b/timeline/index.html new file mode 100644 index 0000000..bb98c7e --- /dev/null +++ b/timeline/index.html @@ -0,0 +1,38 @@ + + + + + + Timeline | 点滴记录 + + + + + + + + +
            • Yesterday Once More!
              + + + diff --git a/uniapp/android.html b/uniapp/android.html new file mode 100644 index 0000000..c83536b --- /dev/null +++ b/uniapp/android.html @@ -0,0 +1,45 @@ + + + + + + Android 打包构建 | 点滴记录 + + + + + + + + +

              Android 打包构建

              # Android 打包构建

              从 HBuilderX 的打包构建可视化界面,来看看我们需要准备哪些东西。

              • Android Package Name (安卓包名): 理解为一个包的唯一标识
              • keystore (签名) +
                • 使用自己生成签名
                • 使用云签名
                • 使用 Test 签名
                • 使用 DCloud 签名
              • Verson (版本): 应用版本号 +
                • Release : 线上版本
                • 自定义 : debugger 版本
              • Native Confusion (代码混合)
              • Ads 广告
              • Mode (模式) +
                • Common Mode (上传代码和凭证,DCloud 不会遵循承若)
                • Safe Mode (上传代码和凭证)

              签名可以参考上一篇 keystore

              # 参考

              uni-app打包成Android Apk详细介绍 (opens new window)

              Last Updated: 6/25/2022, 5:25:39 PM
                + + + diff --git a/uniapp/app-album.html b/uniapp/app-album.html new file mode 100644 index 0000000..845c517 --- /dev/null +++ b/uniapp/app-album.html @@ -0,0 +1,95 @@ + + + + + + 保存图片到相册 | 点滴记录 + + + + + + + + +

                保存图片到相册

                # 保存图片到相册

                # APP

                通常图片的来源分为网络图片本地图片(相册、相机)Base64。 不同的来源,图片保存有一定的差异性。 下面分别针对不同来源,实现图片保存操作。

                • 网络图片

                在 app 实现保存网络图片到相册,这个功能还是比较简单的,只需要使用 uni.downloadFileuni.saveImageToPhotosAlbum 两个 API 即可。前者用来下载网络图片到本地,获取临时路径。 后者基于临时路径进行保存到相册操作。

                具体代码实现:

                uni.downloadFile({
                +  url: 'https://www.example.com/file/test',
                +  success: (res) => {
                +    if (res.statusCode === 200) {
                +      uni.saveImageToPhotosAlbum({
                +        filePath: res.tempFilePath,
                +        success: function () {
                +          console.log('save success');
                +        },
                +      });
                +    }
                +  },
                +});
                +
                • 本地图片(相册、相机)

                需要访问用户相册、相机,在使用时需要获取系统访问权限。

                uni.chooseImage({
                +  count: 1,
                +  sourceType: ['camera'], //支持 'camera', 'album' ,在不指定 sourceType 时,默认情况下支持两种方式
                +  success: function (res) {
                +    uni.saveImageToPhotosAlbum({
                +      filePath: res.tempFilePaths[0],
                +      success: function () {
                +        console.log('save success');
                +      },
                +    });
                +  },
                +});
                +
                • 基于 base64

                通常出现 base64 编码格式的图片情况,通常出现在营销活动宣传海报的。比如基于 canvas 绘制课程海报,活动推广等。

                接下来现分析具体的实现思路:

                uni.saveImageToPhotosAlbum 方法入手,它接收参数为 临时路径永久路径 (不支持网络图片)。 意味着,只需要想办法把 base64 编码格式图片转成本地文件,获取其临时文件路径即可。

                思路有了,那么在 uniapp 中有提供这样的支持 ? 有,可以利用 Bitmap(位图)

                Bitmap 是什么?

                即位图。它本质上就是一张图片的内容在内存中的表达形式

                这里不详细展开,具体可以通过查阅资料了解更多关于 Bitmap 的知识。

                如何去构建对应的 Bitmap 对象? 在 uniapp 中,可以通过 plus+ 中提供 plus.nativeObj.Bitmap 构建位图对象。

                下面具体的实现:

                const bitmap = new plus.nativeObj.Bitmap('bitmap');
                +const base64 = '';
                +// 加载 Base64 编码格式图片到 Bitmap 对象
                +bitmap.loadBase64Data(base64, () => {
                +  // 指定存储临时目录
                +  const url = `_doc/${Date.now()}.png`;
                +  // 保存图片
                +  bitmap.save(
                +    url,
                +    {
                +      overwrite: true,
                +    },
                +    (i) => {
                +      // 保存图片到相册
                +      uni.saveImageToPhotosAlbum({
                +        filePath: i.target,
                +        success() {
                +          console.log('save success');
                +        },
                +      });
                +    },
                +    () => {
                +      uni.showToast({
                +        title: '保存图片失败',
                +      });
                +    }
                +  );
                +});
                +

                关于 plus.nativeObj.Bitmap 详细介绍,可以参考这里 (opens new window).

                Last Updated: 9/1/2024, 6:28:54 PM
                  + + + diff --git a/uniapp/channel.html b/uniapp/channel.html new file mode 100644 index 0000000..a681537 --- /dev/null +++ b/uniapp/channel.html @@ -0,0 +1,79 @@ + + + + + + 构建不同 Channel 包 | 点滴记录 + + + + + + + + +

                  构建不同 Channel 包

                  # 构建不同 Channel 包

                  # 使用 uniapp 内置的

                  对应 HBuilderX 下,Menu > Build > Cloud Packaging

                  如上图所示:

                  HBuilderX 默认提供 7 个渠道(Google、360、小米、华为、应用宝、vivo、oppo),更多可以在manifest.json文件中【源码视图】进行配置。

                  默认渠道 渠道标识ID
                  GooglePlay google
                  应用宝 yyb
                  360应用市场 360
                  华为应用商店 huawei
                  小米应用商店 xiaomi
                  vivo应用商店 vivo
                  oppo应用商店 oppo

                  注意:提交谷歌应用市场(Google Play)时一定要将渠道标识设置为google,即一定要选择打包界面里的google渠道,否则会无法提交到play store

                  # 自定义 Channel 包

                  默认的渠道数量不够使,想要更多渠道?

                  在 manifest.json【源码视图】中, 根节点增加 channel_list 字段.

                  {
                  +    "channel_list":[
                  +        {
                  +            "id":"",
                  +            "name":""
                  +        }
                  +    ]
                  +}
                  +

                  注意,channel_list 添加在根节点

                  比如:

                  {
                  +    "channel_list":[
                  +        {
                  +            "id":"chuizi",
                  +            "name":"锤子应用市场"
                  +        },
                  +               {
                  +            "id":"meizu",
                  +            "name":"魅族应用市场"
                  +        }
                  +    ]
                  +}
                  +

                  配置后会在上面的云端打包界面显示自定义渠道,提交云端打包时需要勾选才能生效。

                  # 代码中根据不同渠道添加个性化参数或功能

                  // 获取渠道 ID
                  +plus.runtime.channel
                  +// 此方法可获取基本的app信息,如版本号,名称等
                  +plus.runtime
                  +

                  # 整合 umeng 对不同的渠道包进行数据分析

                  默认 HbulderX 中提供对友盟SDK支持,在使用时只需要通过简单的配置即可。

                  首先打开 manifest.json 的可视化视图界面,进入 App模块配置 -> 勾选 Statistic -> 再勾选 友盟统计 如下:

                  从上图中可以看到需要填写项 appkey_ioschannelid_iosappkey_androidchannelid_android,其中 appkey_ioschannelid_android 是必填项。 对应的是您在 友盟后台 (opens new window) 申请的应用ID。

                  channelid_ioschannelid_android 可选,属性的作用用于区分来自不同渠道 APP。ios 基本只有一个渠道,android 渠道相应多点,比如应用宝华为小米viovoppe 等。

                  同样进入可视化视图之后可以看到如下配置内容:

                  {
                  +    "sdkConfigs":{
                  +        "statics" : {
                  +            "umeng" : {
                  +                "appkey_ios" : "******************",
                  +                "channelid_ios" : "iOS平台的渠道字符串,可输入任意字符串",
                  +                "appkey_android" : "******************",
                  +                "channelid_android" : "huawei"
                  +            }
                  +        }
                  +    }
                  +}
                  +

                  集成成功之后,开始进行进入 coding 阶段,那么在代码中如何进行数据的上报呢 ? plus.statistic (opens new window)

                  plus.statistic.eventTrig("eventName", "事件参数");
                  +
                  • eventName: 是在友盟定义的事件名称。
                  • params: 自定义,需要上报到友盟的数据体。

                  ⚠️注意:配置完成后,要用自己的 app 证书等信息,打包自定义调试基座,或者云打包正式 app 后才能生效。

                  # 注意事项

                  • uniapp 进行云打包的时候,如果友盟上报需要区分不同渠道,则需要一个一个进行打包。
                  • uniapp 上报的数据实时性的问题,友盟对于部分数据时性需要是付费用户。 当天上报的可能存在看不到的现象。

                  # 参考

                  Last Updated: 6/25/2022, 5:25:39 PM
                    + + + diff --git a/uniapp/created.html b/uniapp/created.html new file mode 100644 index 0000000..a6a420b --- /dev/null +++ b/uniapp/created.html @@ -0,0 +1,50 @@ + + + + + + 快速上手 | 点滴记录 + + + + + + + + +

                    快速上手

                    # 快速上手

                    Uniapp 官方提供两种创建项目的方式:

                    • HBuilderX 开发者工具
                    • vue-cli 命令行工具

                    具体两者创建的区别,大家可以查阅 Uniapp 官方的介绍 cli创建项目和使用HBuilderX可视化界面创建项目有什么区别 +# (opens new window)

                    通过 vue-cli 创建的项目模版,更接近平常开发 Vue 项目结构,这样能够减少熟悉的成本。

                    下面通过 vue-cli 来创建项目模版。

                    # 步骤如下

                    # 安装 CLI

                    假设已经安装的话,可以忽略当前步骤。

                    npm install -g @vue/cli@4
                    +

                    # 创建 uni-app

                    • 使用正式版(对应HBuilderX最新正式版)
                    vue create -p dcloudio/uni-preset-vue my-project
                    +
                    • 使用alpha版(对应HBuilderX最新alpha版)
                    vue create -p dcloudio/uni-preset-vue#alpha my-alpha-project
                    +

                    # 注意事项

                    dcloudio/uni-preset-vue 是一个预设的模版,它内容是在 Github 上,在安装的时可能会出现查找模版失败的问 +题。

                    ERROR Failed fetching remote preset dcloudio/uni-preset-vue:
                    +ERROR RequestError: read ECONNRESET
                    +

                    上面错误是,需要科学上网才能正常访问。

                    通常可以把 dcloudio/uni-preset-vue 模版下载下来,然后创建时 dcloudio/uni-preset-vue 指向本地的模版,如下:

                    vue create -p ./本地目录/dcloudio/uni-preset-vue my-project
                    +

                    # 使用自定义模版

                    uni-vue-template (opens new window)

                    上面的模版也是通过 Vue CLI 创建的,只是在它基础上添加一些内容。

                    • 常见工具类封装(路由、请求、登录、获取手机号码等等)。
                    • 代码检测(ESLint,Git hook,lint-staged) 等等。

                    基本可以开箱即用,让我们更加聚焦在业务层面的开发。

                    Last Updated: 6/25/2022, 5:25:39 PM
                      + + + diff --git a/uniapp/download.html b/uniapp/download.html new file mode 100644 index 0000000..5d6bd85 --- /dev/null +++ b/uniapp/download.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

                      Last Updated: 9/1/2024, 6:28:54 PM
                        + + + diff --git a/uniapp/event-channel.html b/uniapp/event-channel.html new file mode 100644 index 0000000..4700603 --- /dev/null +++ b/uniapp/event-channel.html @@ -0,0 +1,342 @@ + + + + + + EventChannel | 点滴记录 + + + + + + + + +

                        EventChannel

                        # EventChannel

                        在本文中,我们将探讨如何在 uniapp 中利用 EventChannel 实现页面之间的高效通信。EventChannel 是 uniapp 提供的一种专门用于页面间通信的机制,特别适合在页面间传递数据或更新状态的场景。

                        # 实际业务场景

                        为了更好地理解 EventChannel 的应用,我们来看一个典型的业务场景:假设在一个电商应用中,有一个订单列表,其中某个订单的状态为“待付款”。用户点击该订单,进入订单详情页面。在订单详情页面,用户选择“取消订单”,操作成功后,该订单的状态变为“已取消”。

                        此时,我们面临一个问题:如何在订单详情页面取消订单后,自动更新订单列表页面中对应订单的状态,使其从“待付款”变为“已取消”。

                        一种简单直接的解决方案是在订单列表页面中使用 onShow 生命周期方法,在每次页面重新展示时调用接口重新获取订单列表。然而,这种方法存在以下缺点:

                        • 资源浪费:用户每次切换页面都会触发加载操作,导致不必要的网络请求和资源浪费。
                        • 用户体验不佳:如果用户在订单列表中点击的订单位于列表中间或底部,跳转回列表页面后,滚动位置可能会丢失,导致用户体验不佳。

                        为了解决这些问题,我们可以采用一种更加无缝和智能的方式,这正是 EventChannel 的用武之地。

                        EventChannel 可以在两个页面间建立通信通道,当订单详情页面的状态发生变化时,及时通知订单列表页面更新状态,无需额外的页面刷新或滚动位置丢失。此外,EventChannel 也不是唯一的选择。我们还可以通过全局状态管理(如 Paina)、EventBus 等方式来实现类似的效果。

                        在接下来的部分,我们将详细介绍如何使用 EventChannel 实现这一场景下的页面通信。

                        # 使用方法

                        # 在订单列表页面监听事件

                        // order.vue
                        +const orderList = ref([]);
                        +uni.navigateTo({
                        +  url: '/order-detail',
                        +  events: {
                        +    orderStatusChange({ orderId, status }) {
                        +      // 从列单列表中查询对应项
                        +      const index = orderList.value.findIndex((order) => order.id === orderId);
                        +      if (index !== -1) {
                        +        // 修改订单状态
                        +        orderList.value[index].status = data.status;
                        +        // 同样删除也可以
                        +        //  orderList.value.splice(index, 1);
                        +      }
                        +    },
                        +  },
                        +});
                        +

                        在跳转到订单详情页面时,通过 navigateTo 方法传递 events 属性,用于监听订单状态变化事件。

                        # 在订单详情页面发送事件

                        // order-detail.vue
                        +const { proxy } = getCurrentInstance();
                        +let eventChannel = null;
                        +const handleCancel = () => {
                        +  // 取消订单操作
                        +  // ...
                        +  // 执行通信
                        +  eventChannel.emit('orderStatusChange', {
                        +    orderId: '1234567',
                        +    status: 'cancel',
                        +  });
                        +};
                        +onLoad(() => {
                        +  eventChannel = proxy.getOpenerEventChannel();
                        +});
                        +

                        在订单详情页面中,通过 getOpenerEventChannel 方法获取到打开订单详情页面的 EventChannel 对象,并通过调用 emit 方法发送消息。

                        # EventChannel 是什么

                        事实上,·EventChannel 的内部实现可以看作是一个自定义事件类,通过事件的发布(emit)和订阅(on)机制,实现页面之间的数据通信。

                        下面就是具体实现。

                        type NavigateToOptionEvents = Record<string, (...args: any[]) => void>
                        +
                        +interface EventChannelListener {
                        +  type: 'on' | 'once'
                        +  fn: (...args: any[]) => void
                        +}
                        +
                        +export class EventChannel {
                        +  id?: number
                        +  private listener: Record<string, EventChannelListener[]>
                        +  private emitCache: {
                        +    args: any[]
                        +    eventName: string
                        +  }[]
                        +  constructor(id?: number, events?: NavigateToOptionEvents) {
                        +    this.id = id
                        +    this.listener = {}
                        +    this.emitCache = []
                        +    if (events) {
                        +      Object.keys(events).forEach((name) => {
                        +        this.on(name, events[name])
                        +      })
                        +    }
                        +  }
                        +
                        +  emit(eventName: string, ...args: any[]) {
                        +    const fns = this.listener[eventName]
                        +    if (!fns) {
                        +      return this.emitCache.push({
                        +        eventName,
                        +        args,
                        +      })
                        +    }
                        +    fns.forEach((opt) => {
                        +      opt.fn.apply(opt.fn, args)
                        +    })
                        +    this.listener[eventName] = fns.filter((opt) => opt.type !== 'once')
                        +  }
                        +
                        +  on(eventName: string, fn: EventChannelListener['fn']) {
                        +    this._addListener(eventName, 'on', fn)
                        +    this._clearCache(eventName)
                        +  }
                        +
                        +  once(eventName: string, fn: EventChannelListener['fn']) {
                        +    this._addListener(eventName, 'once', fn)
                        +    this._clearCache(eventName)
                        +  }
                        +
                        +  off(eventName: string, fn: EventChannelListener['fn']) {
                        +    const fns = this.listener[eventName]
                        +    if (!fns) {
                        +      return
                        +    }
                        +    if (fn) {
                        +      for (let i = 0; i < fns.length; ) {
                        +        if (fns[i].fn === fn) {
                        +          fns.splice(i, 1)
                        +          i--
                        +        }
                        +        i++
                        +      }
                        +    } else {
                        +      delete this.listener[eventName]
                        +    }
                        +  }
                        +
                        +  _clearCache(eventName?: string) {
                        +    for (let index = 0; index < this.emitCache.length; index++) {
                        +      const cache = this.emitCache[index]
                        +      const _name = eventName
                        +        ? cache.eventName === eventName
                        +          ? eventName
                        +          : null
                        +        : cache.eventName
                        +      if (!_name) continue
                        +      const location = this.emit.apply(this, [_name, ...cache.args])
                        +      if (typeof location === 'number') {
                        +        this.emitCache.pop()
                        +        continue
                        +      }
                        +      this.emitCache.splice(index, 1)
                        +      index--
                        +    }
                        +  }
                        +
                        +  _addListener(
                        +    eventName: string,
                        +    type: EventChannelListener['type'],
                        +    fn: EventChannelListener['fn']
                        +  ) {
                        +    ;(this.listener[eventName] || (this.listener[eventName] = [])).push({
                        +      fn,
                        +      type,
                        +    })
                        +  }
                        +}
                        +

                        在了解 EventChannel 实现之后,接下来看下两个页面是如何共享 EventChannel 实例的。

                        # 两个页面是如何共享 EventChannel 实例的

                        页面之间之所以能够实现通信,关键在于它们共享同一个 EventChannel 实例。同时,新页面能够通过调用 getOpenerEventChannel 方法获取到这个共享的实例。

                        要深入理解这一机制,我们需要了解 uni.navigateTo 方法和 getOpenerEventChannel 方法各自的工作原理。

                        接下来看下内部实现:

                        function navigateTo({
                        +  url,
                        +  path,
                        +  query,
                        +  events,
                        +  aniType,
                        +  aniDuration,
                        +}: NavigateToOptions): Promise<void | { eventChannel: EventChannel }> {
                        +  // 创建 eventChannel
                        +  const eventChannel = new EventChannel(getWebviewId() + 1, events);
                        +  return new Promise((resolve) => {
                        +    showWebview(
                        +      registerPage({ url, path, query, openType: 'navigateTo', eventChannel }),
                        +      aniType,
                        +      aniDuration,
                        +      () => {
                        +        resolve({ eventChannel });
                        +      }
                        +    );
                        +    setStatusBarStyle();
                        +  });
                        +}
                        +

                        上面看到把 eventChannel 传递给了 registerPage 方法。

                        // registerPage 方法
                        +export function registerPage({
                        +  url,
                        +  path,
                        +  query,
                        +  openType,
                        +  webview,
                        +  nvuePageVm,
                        +  eventChannel,
                        +}: RegisterPageOptions) {
                        +  if (!webview) {
                        +    webview = createWebview({ path, routeOptions, query })
                        +  } else {
                        +    webview = plus.webview.getWebviewById(webview.id)
                        +    ;(webview as any).nvue = routeOptions.meta.isNVue
                        +  }
                        +  initWebview(webview, path, query, routeOptions.meta)
                        +
                        +  const pageInstance = initPageInternalInstance(
                        +    // ...,
                        +    eventChannel,
                        +  )
                        +  createVuePage(id, route, query, pageInstance, initPageOptions(routeOptions))
                        +  return webview
                        +}
                        +

                        在 registerPage 中主要做了几件事:

                        • 创建 webview 实例
                        • 初始化 webview
                        • 初始化页面内部实例
                        • 创建 vue 页面
                        export function initPageInternalInstance(
                        +  openType: UniApp.OpenType,
                        +  url: string,
                        +  pageQuery: Record<string, any>,
                        +  meta: UniApp.PageRouteMeta,
                        +  eventChannel?: EventChannel,
                        +  themeMode?: UniApp.ThemeMode
                        +): Page.PageInstance['$page'] {
                        +  const { id, route } = meta
                        +  return {
                        +    id: id!,
                        +    route: route,
                        +    fullPath: url,
                        +    options: pageQuery,
                        +    meta,
                        +    openType,
                        +    eventChannel,
                        +    statusBarStyle: titleColor === '#ffffff' ? 'light' : 'dark',
                        +  }
                        +}
                        +

                        这方法并没有做太多逻辑处理。 只要记住 eventChannel 放入内部实例中,接着往下看 createVuePage

                        function createFactory(component: VuePageAsyncComponent | VuePageComponent) {
                        +  return () => {
                        +    if (isVuePageAsyncComponent(component)) {
                        +      return component().then((component) => setupPage(component))
                        +    }
                        +    return setupPage(component)
                        +  }
                        +}
                        +export const pagesMap = new Map<string, ReturnType<typeof createFactory>>()
                        +
                        +export function definePage(
                        +  pagePath: string,
                        +  asyncComponent: VuePageAsyncComponent | VuePageComponent
                        +) {
                        +  pagesMap.set(pagePath, once(createFactory(asyncComponent)))
                        +}
                        +
                        +export function createVuePage(
                        +  __pageId: number,
                        +  __pagePath: string,
                        +  __pageQuery: Record<string, any>,
                        +  __pageInstance: Page.PageInstance['$page'],
                        +  pageOptions: PageNodeOptions
                        +) {
                        +  const pageNode = createPageNode(__pageId, pageOptions, true)
                        +  // 获取 Vue 根应用
                        +  const app = getVueApp()
                        +  // 根据路径获取页面组件
                        +  const component = pagesMap.get(__pagePath)!()
                        +  // 页面挂载
                        +  const mountPage = (component: VuePageComponent) =>
                        +    app.mountPage(
                        +      component,
                        +      extend(
                        +        {
                        +          __pageId,
                        +          __pagePath,
                        +          __pageQuery,
                        +          __pageInstance,
                        +        },
                        +        __pageQuery
                        +      ),
                        +      pageNode
                        +    )
                        +  if (isPromise(component)) {
                        +    return component.then((component) => mountPage(component))
                        +  }
                        +  return mountPage(component)
                        +}
                        +
                        +const mountPage = (
                        +  pageComponent: VuePageComponent,
                        +  pageProps: Record<string, any>,
                        +  pageContainer: UniNode
                        +) => {
                        +  const vnode = createVNode(pageComponent, pageProps)
                        +  // store app context on the root VNode.
                        +  // this will be set on the root instance on initial mount.
                        +  vnode.appContext = appContext
                        +  ;(vnode as any).__page_container__ = pageContainer
                        +  render(vnode, pageContainer as unknown as Element)
                        +  const publicThis = vnode.component!.proxy!
                        +  ;(publicThis as any).__page_container__ = pageContainer
                        +  return publicThis
                        +}
                        +

                        在上述代码中,__pageInstance 被作为 pageProps 传递给 mountPage 方法。当执行 mountPage 后,pageProps 会被添加到组件的上下文 context 对象中 attrs 属性中。

                        在前面的代码中,虽然没有直接看到对 eventChannel 对象的使用,但它主要用于参数传递。回顾前面提到的使用方法部分,我们注意到在页面中通过 proxy.getOpenerEventChannel() 来获取 eventChannel 实例,也就是说,getOpenerEventChannel 是在页面实例上添加的。那么,它是何时被添加到实例上的呢? setupPage 中。

                        setupPage 方法代码如下:

                        export function setupPage(component: VuePageComponent) {
                        +  const oldSetup = component.setup
                        +  component.setup = (props, ctx) => {
                        +    const {
                        +      attrs: { __pageId, __pagePath, /*__pageQuery,*/ __pageInstance },
                        +    } = ctx
                        +    const instance = getCurrentInstance()!
                        +    const pageVm = instance.proxy!
                        +    initPageVm(pageVm, __pageInstance as Page.PageInstance['$page'])
                        +    if (pageVm.$page.openType !== 'openDialogPage') {
                        +      addCurrentPage(
                        +        initScope(
                        +          __pageId as number,
                        +          pageVm,
                        +          __pageInstance as Page.PageInstance['$page']
                        +        )
                        +      )
                        +    }
                        +    if (oldSetup) {
                        +      return oldSetup(props, ctx)
                        +    }
                        +  }
                        +  return component
                        +}
                        +
                        +export function initScope(
                        +  pageId: number,
                        +  vm: ComponentPublicInstance,
                        +  pageInstance: Page.PageInstance['$page']
                        +) {
                        +  //
                        +  vm.getOpenerEventChannel = () => {
                        +    if (!pageInstance.eventChannel) {
                        +      pageInstance.eventChannel = new EventChannel(pageId)
                        +    }
                        +    return pageInstance.eventChannel as EventChannel
                        +  }
                        +  return vm
                        +}
                        +

                        setupPage 通过重写组件的 setup 函数,同时保留组件的默认 setup 功能,这正是面向切面编程的一个典型示例。

                        initScope 方法中,getOpenerEventChannel 被添加到了 vm 实例对象上,这正是我们能够通过 proxy 访问到 getOpenerEventChannel 的原因

                        至此,我们已经基本掌握了 EventChannel 在页面间通信的使用方法及其实现原理。

                        Last Updated: 9/1/2024, 8:19:59 PM
                          + + + diff --git a/uniapp/faq.html b/uniapp/faq.html new file mode 100644 index 0000000..a154e00 --- /dev/null +++ b/uniapp/faq.html @@ -0,0 +1,75 @@ + + + + + + 常见问题 | 点滴记录 + + + + + + + + +

                          常见问题

                          # 常见问题

                          # 小程序

                          通常小程序码由后台生成后,外部通过扫码进入小程序。 扫码直接跳转的是 Release 版本。

                          那有时想调试本地下小程序码生成的内容,显然通过 debugger 版本是做不到的, 假设获取对应页面信息,有办法可以做到呢? 通过 wx.scanCodeuni.scanCode 功能。

                          代码如下:

                          uni.scanCode({
                          +  success: function (res) {
                          +    console.log('条码类型:' + res.scanType);
                          +    console.log('条码内容:' + res.result);
                          +    console.log(res);
                          +  }
                          +});
                          +
                          • 如何打开线上版本小程序的调试模式

                          生产版本的小程序如果出现问题,可以调试一下正式版看看,调试方式如下

                          方式一: https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html

                          // 打开调试
                          +wx.setEnableDebug({
                          +  enableDebug: true
                          +})
                          +
                          +// 关闭调试
                          +wx.setEnableDebug({
                          +  enableDebug: false
                          +})
                          +
                          +

                          方式二: 先在开发版或体验版打开调试,再切到正式版就能看到vConsole

                          # APP

                          # 1. Android 部分机型中,经常会出现虚拟菜单,虚拟菜单某些情况下会遮住功能菜单

                          // 利用 5+ 能力,隐藏具体虚拟菜单
                          +plus.navigator.hideSystemNavigation();
                          +

                          # 2. webview全屏遮挡住状态栏的解决方案

                          webview全屏遮挡住状态栏的解决方案 (opens new window)

                          # 3. 打包后关闭手机的旋转

                          // #ifdef APP-PLUS
                          +  plus.screen.lockOrientation('portrait-primary');
                          +// #endif
                          +
                          • unlockOrientation()方法恢复到应用的默认值。

                          参数:

                          • orientation: ( String ) 必选 要锁定的屏幕方向值

                          锁定屏幕方向可取以下值:

                          • “portrait-primary”: 竖屏正方向;
                          • “portrait-secondary”: 竖屏反方向,屏幕正方向按顺时针旋转180°;
                          • “landscape-primary”: 横屏正方向,屏幕正方向按顺时针旋转90°;
                          • “landscape-secondary”: 横屏方向,屏幕正方向按顺时针旋转270°;
                          • “portrait”: 竖屏正方向或反方向,根据设备重力感应器自动调整;
                          • “landscape”: 横屏正方向或反方向,根据设备重力感应器自动调整;

                          # 4. 打包时提示这个错误

                          在进行云打包时,此 APP 包使用 address book permission,当前打包账号没有进行实名认证。

                          解决该问题的两种方式:

                          # 5. VueCli 创建的项目安装了 node-sass 后在HBuilderX中无法运行

                          Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x +Found bindings for the following environments:

                          • OS X 64-bit with Node.js 14.x

                          造成这个原因主要原因,HbuilderX 中默认包含一个 node 版本, node-sassnode 版本有对应关系,也就不同 node-sass 版本依赖不同的 node 版本。

                          解决这个方式有两种:

                            1. 降低项目中 node-sass 版本。 +node-sassnode 对应关系,可以查看这里 node-sass (opens new window)
                            1. 更改 HBuilderX 中 node 版本。
                          // 进入 HBuilderX 插件目录
                          +$ cd /Applications/HBuilderX.app/Contents/HBuilderX/plugins/node
                          +// 重新命名,备份一下 node 版本
                          +$ mv node node-v12
                          +
                          +// 软链接
                          +$ ln -s /usr/local/bin/node /Applications/HBuilderX.app/Contents/HBuilderX/plugins/node/node
                          +

                          注意

                          /usr/local/bin/node 是本地 node 安装路径,有的可能通过 nvm 安装目录地址不一样,需要您根据实际情况调整。 +/Applications/HBuilderX.app/Contents/HBuilderX/plugins/node/node 是 HBuilderX 内部 node 版本的位置。

                          # H5

                          # Java

                          • 查看 Java 目录,查看 keytools
                          /usr/libexec/java_home -V
                          +
                          Last Updated: 6/25/2022, 5:25:39 PM
                            + + + diff --git a/uniapp/flex.html b/uniapp/flex.html new file mode 100644 index 0000000..46503d4 --- /dev/null +++ b/uniapp/flex.html @@ -0,0 +1,156 @@ + + + + + + Flex 布局 | 点滴记录 + + + + + + + + +

                            Flex 布局

                            # Flex 布局

                            Flex 在移动端开发中使用最多布局方式和,基本上无需考虑其兼容性。 在编写页面的时,一个好的 CSS 工具可以提升开发效率。

                            通常使用第三方提供的 flex.css ,提供辅助类帮助快速构建用户界面。

                            
                            +/* ========================================================================
                            +   Component: Flex
                            + ========================================================================== */
                            +
                            + .flex { display: flex; }
                            + .flex-inline { display: inline-flex; }
                            +
                            + /*
                            +  * Remove pseudo elements created by micro clearfix as precaution
                            +  */
                            +
                            + .flex::before,
                            + .flex::after,
                            + .flex-inline::before,
                            + .flex-inline::after { display: none; }
                            +
                            +
                            + /* Alignment
                            +  ========================================================================== */
                            +
                            + /*
                            +  * Align items along the main axis of the current line of the flex container
                            +  * Row: Horizontal
                            +  */
                            +
                            + // Default
                            + .flex-left { justify-content: flex-start; }
                            + .flex-center { justify-content: center; }
                            + .flex-right { justify-content: flex-end; }
                            + .flex-between { justify-content: space-between; }
                            + .flex-around { justify-content: space-around; }
                            +
                            +
                            + /*
                            +  * Align items in the cross axis of the current line of the flex container
                            +  * Row: Vertical
                            +  */
                            +
                            + // Default
                            + .flex-stretch { align-items: stretch; }
                            + .flex-top { align-items: flex-start; }
                            + .flex-middle { align-items: center; }
                            + .flex-bottom { align-items: flex-end; }
                            +
                            +
                            + /* Direction
                            +  ========================================================================== */
                            +
                            + // Default
                            + .flex-row { flex-direction: row; }
                            + .flex-row-reverse { flex-direction: row-reverse; }
                            + .flex-column { flex-direction: column; }
                            + .flex-column-reverse { flex-direction: column-reverse; }
                            +
                            +
                            + /* Wrap
                            +  ========================================================================== */
                            +
                            + // Default
                            + .flex-nowrap { flex-wrap: nowrap; }
                            + .flex-wrap { flex-wrap: wrap; }
                            + .flex-wrap-reverse { flex-wrap: wrap-reverse; }
                            +
                            + /*
                            +  * Aligns items within the flex container when there is extra space in the cross-axis
                            +  * Only works if there is more than one line of flex items
                            +  */
                            +
                            + // Default
                            + .flex-wrap-stretch { align-content: stretch; }
                            + .flex-wrap-top { align-content: flex-start; }
                            + .flex-wrap-middle { align-content: center; }
                            + .flex-wrap-bottom { align-content: flex-end; }
                            + .flex-wrap-between { align-content: space-between; }
                            + .flex-wrap-around { align-content: space-around; }
                            +
                            +
                            + /* Item ordering
                            +  ========================================================================== */
                            +
                            + /*
                            +  * Default is 0
                            +  */
                            +
                            + .flex-first { order: -1;}
                            + .flex-last { order: 99;}
                            +
                            +
                            + /* Item dimensions
                            +  ========================================================================== */
                            +
                            + /*
                            +  * Initial: 0 1 auto
                            +  * Content dimensions, but shrinks
                            +  */
                            +
                            + /*
                            +  * No Flex: 0 0 auto
                            +  * Content dimensions
                            +  */
                            +
                            + .flex-none { flex: none; }
                            +
                            + /*
                            +  * Relative Flex: 1 1 auto
                            +  * Space is allocated considering content
                            +  */
                            +
                            + .flex-auto { flex: auto; }
                            +
                            + /*
                            +  * Absolute Flex: 1 1 0%
                            +  * Space is allocated solely based on flex
                            +  */
                            +
                            + .flex-1 { flex: 1; }
                            +
                            +

                            # 可视化 Flex 工具

                            flexyboxes (opens new window)

                            Last Updated: 6/25/2022, 5:25:39 PM
                              + + + diff --git a/uniapp/get-phone-number.html b/uniapp/get-phone-number.html new file mode 100644 index 0000000..dcac493 --- /dev/null +++ b/uniapp/get-phone-number.html @@ -0,0 +1,42 @@ + + + + + + 获取手机号码 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/get-user-info.html b/uniapp/get-user-info.html new file mode 100644 index 0000000..59f0a67 --- /dev/null +++ b/uniapp/get-user-info.html @@ -0,0 +1,42 @@ + + + + + + 获取用户信息 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/h5-album.html b/uniapp/h5-album.html new file mode 100644 index 0000000..a26db4b --- /dev/null +++ b/uniapp/h5-album.html @@ -0,0 +1,82 @@ + + + + + + 保存图片到相册 | 点滴记录 + + + + + + + + +

                              保存图片到相册

                              # 保存图片到相册

                              通常有几种方式基于图片资源URLBase64

                              # 添加响应头

                              • Content-Disposition: 'attachmeent'
                              • Content-Type: application/octet-stream

                              # 如何在 base64 示例中应用 URL.createObjectURL()

                                1. 如何把 base 64 转换为 blob
                              import { base64StringToBlob } from 'blob-util';
                              +
                              +const contentType = 'image/png';
                              +const b64Data = 'iVb........'; // base64 数据
                              +
                              +const blob = base64StringToBlob(b64Data, contentType);
                              +
                                1. base64 转换为 blob
                              const byteCharacters = atob(b64);
                              +const byteNumbers = new Array(byteCharacters.length);
                              +for (let i = 0; i < byteCharacters.length; i++) {
                              +  byteNumbers[i] = byteCharacters.charCodeAt(i);
                              +}
                              +const byteArray = new Uint8Array(byteNumbers);
                              +const blob = new Blob([byteArray], { type: 'audio/mp3' });
                              +
                                1. 下载示例
                              function dataURLtoBlob(dataurl) {
                              +  const arr = dataurl.split(',');
                              +  const mime = arr[0].match(/:(.*?);/)[1];
                              +  const bstr = atob(arr[1]);
                              +  let n = bstr.length;
                              +  const u8arr = new Uint8Array(n);
                              +  while (n--) {
                              +    u8arr[n] = bstr.charCodeAt(n);
                              +  }
                              +  return new Blob([u8arr], { type: mime });
                              +}
                              +
                              +function downloadFile(url, name = 'defalut') {
                              +  const a = document.createElement('a');
                              +  a.setAttribute('href', url);
                              +  a.setAttribute('download', name);
                              +  a.setAttribute('target', '_blank');
                              +  const clickEvent = document.createEvent('MouseEvents');
                              +  clickEvent.initEvent('click', true, true);
                              +  a.dispatchEvent(clickEvent);
                              +}
                              +
                              +function downloadFileByBase64(base64, name) {
                              +  const myBlob = dataURLtoBlob(base64);
                              +  const myUrl = URL.createObjectURL(myBlob);
                              +  downloadFile(myUrl, name);
                              +}
                              +
                              Last Updated: 9/1/2024, 6:28:54 PM
                                + + + diff --git a/uniapp/h5.html b/uniapp/h5.html new file mode 100644 index 0000000..7147087 --- /dev/null +++ b/uniapp/h5.html @@ -0,0 +1,38 @@ + + + + + + Uniapp 打包发布 H5 | 点滴记录 + + + + + + + + +

                                Uniapp 打包发布 H5

                                Last Updated: 6/25/2022, 5:25:39 PM
                                  + + + diff --git a/uniapp/hybird.html b/uniapp/hybird.html new file mode 100644 index 0000000..90192e8 --- /dev/null +++ b/uniapp/hybird.html @@ -0,0 +1,74 @@ + + + + + + H5 与 webview 交互 | 点滴记录 + + + + + + + + +

                                  H5 与 webview 交互

                                  # H5 与 webview 交互

                                  web-view 是一个 web 浏览器组件,可以用来承载网页的容器,会自动铺满整个页面(nvue 使用需要手动指定宽高).

                                  # 基本使用

                                  <template>
                                  +  <web-view src="https://www.baidu.com"></web-view>
                                  +</template>
                                  +

                                  web-view 组件详细使用,可以参考官方 web-view (opens new window). 在 uniapp 中 web-view 可设置属性并没详细罗列,需要参考 html5plus (opens new window)

                                  下面通过一个实际案例来了解它们的使用。

                                  # 实际案例

                                  在开发 51趣味营销 活动的时候,活动页是通过单独 h5 开发的。开发的 h5 页面需要嵌入到 app微信公众号 中进行营销。

                                  既然需要嵌入到 app 中,那么就需要使用到 web-view 组件。

                                  先来说下 h5 中包含那些需要与 app 交互的内容,微信朋友分享微信朋友圈分享一键获取干货(打开小程序)。

                                  知道内容之后,可以开始探索一下如何完成接入、微信分享、唤醒小程序。

                                  # 3.1 利用 webview 加载 h5

                                  <template>
                                  +  <view class="container">
                                  +    <web-view @message="message" :src="src"></web-view>
                                  +  </view>
                                  +</template>
                                  +
                                  +<script>
                                  +  let wv;
                                  +  export default {
                                  +    data() {
                                  +      return {
                                  +        src: ''
                                  +      }
                                  +    },
                                  +    onLoad(options){
                                  +      this.src = options.src;
                                  +      // #ifdef APP-PLUS
                                  +      // 此对象相当于 html5plus 里的 plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.
                                  +      const currentWebview = this.$scope.$getAppWebview() $getAppWebview()
                                  +      setTimeout(function() {
                                  +        wv = currentWebview.children()[0]
                                  +        wv.setStyle({
                                  +            scalable: false
                                  +        })
                                  +      }, 200); //如果是页面初始化调用时,需要延时一下
                                  +      // #endif
                                  +    }
                                  +  }
                                  +</script>
                                  +

                                  这样基本上,就

                                  # 3.2 引入 uni.webview.js

                                  # 3.3 唤醒微信

                                  # 附录

                                  Last Updated: 9/1/2024, 6:28:54 PM
                                    + + + diff --git a/uniapp/index.html b/uniapp/index.html new file mode 100644 index 0000000..0237ba1 --- /dev/null +++ b/uniapp/index.html @@ -0,0 +1,40 @@ + + + + + + 简介 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/ios.html b/uniapp/ios.html new file mode 100644 index 0000000..40d1346 --- /dev/null +++ b/uniapp/ios.html @@ -0,0 +1,42 @@ + + + + + + iOS 打包构建 | 点滴记录 + + + + + + + + +

                                    iOS 打包构建

                                    # iOS 打包构建

                                    1. 先创建证书

                                    https://ask.dcloud.net.cn/article/152

                                    1. 选择证书打包
                                    Last Updated: 6/30/2022, 4:14:26 PM
                                      + + + diff --git a/uniapp/keystore.html b/uniapp/keystore.html new file mode 100644 index 0000000..e4d1e84 --- /dev/null +++ b/uniapp/keystore.html @@ -0,0 +1,46 @@ + + + + + + 生成签名 | 点滴记录 + + + + + + + + +

                                      生成签名

                                      # 生成签名

                                      # 签名是什么

                                      Android Keystore 漫谈 (opens new window)

                                      # 生成签名

                                      • 通过 JDK
                                      • Android Studio

                                      首先通过 JDK 的方式来生成,大概的步骤的如下

                                      # 安装 JDK

                                      对于 Mac 用户而言,可以通过 Macbrew 来快捷安装。

                                      进入 terminal ,输入如下命令

                                      brew tap AdoptOpenJDK/openjdk
                                      +brew install adoptopenjdk8  // 此处写java8会提示找不到
                                      +
                                      +java // 检测是否安装成功
                                      +

                                      # 借助 Keytool 生成 Keystore

                                      keytool -genkey -keyalg RSA -alias mykeystore -keystore mykeystore.jks -storepass 12345678 -validity 360

                                      上面每个 keytool 表示:

                                      • -genkey: 此命令用于生成密钥
                                      • -keyalg RSA: 生成密码使用算法
                                      • -alias mykeystore: 产生别名,后面跟别名内容。若未指定,则别名默认为 mykey.
                                      • -keysotre mykeystore.jks : 这表示您正在创建或已经使用的 keystore 的名称。
                                      • storepass : 指定 keystore 密码
                                      • -validity : 指定生成密钥的使用有效期,单位为天

                                      在命令行输入上面命令后,则在控制台依次需要输入如下内容:

                                      • CN:名字或姓氏
                                      • OU:组织单位名称
                                      • O:组织名称
                                      • L:城市或区域名称
                                      • ST:州或省份名称
                                      • C:单位的两字国家代码

                                      这样基本上完成 keystore 的生成,接下来我们可以去 HBuilderX 中浅尝一下打包。

                                      # Android 签名

                                      进入菜单 Menu > Build > 选择 MobileApp - Cloud Packaging

                                      Last Updated: 6/25/2022, 5:25:39 PM
                                        + + + diff --git a/uniapp/local-store.html b/uniapp/local-store.html new file mode 100644 index 0000000..b7fc34b --- /dev/null +++ b/uniapp/local-store.html @@ -0,0 +1,38 @@ + + + + + + 本地存储 | 点滴记录 + + + + + + + + +

                                        本地存储

                                        # 本地存储

                                        Last Updated: 6/25/2022, 5:25:39 PM
                                          + + + diff --git a/uniapp/login.html b/uniapp/login.html new file mode 100644 index 0000000..60e99ee --- /dev/null +++ b/uniapp/login.html @@ -0,0 +1,336 @@ + + + + + + 登录 | 点滴记录 + + + + + + + + +

                                          登录

                                          # 登录

                                          # 1. 小程序登录

                                          小程序有两种登录方式,一种基于手机号码进行登录,另一种是使用用户在公众号下的唯一标识(openid)进行登录(小程序是公众号的一种).

                                          接下来先讲解下,基于 openid 登录。

                                          # 1.1 基于 openid 登录

                                          先看下图,描述通过微信小程序提供的 code 换取当前用户在小程序中的唯一标识,详细流程可以参数下图:

                                          接下来通过代码实现下大概流程:

                                          • 获取 code
                                          uni.login({
                                          +  success: async (res) => {
                                          +    if (res.errMsg === 'login:ok') {
                                          +      const { data } = await login({
                                          +        code: res.code,
                                          +      });
                                          +      // 保存用户信息
                                          +    }
                                          +  },
                                          +  fail(e) {
                                          +    uni.showToast({
                                          +      title: e.message,
                                          +    });
                                          +  },
                                          +});
                                          +
                                          • 服务端接收 code 去微信后台换取对应 openid
                                          // nodejs 部分代码
                                          +const { appid, secret, grant_type } = require('../config/wx');
                                          +router.post('/login', (req, res) => {
                                          +  const { code } = req.query;
                                          +  const { appid, secret, grant_type } = require('../config/wx');
                                          +  const { openid } = await request.get('/sns/jscode2session', {
                                          +    appid,
                                          +    secret,
                                          +    js_code: code,
                                          +    grant_type,
                                          +  });
                                          +});
                                          +
                                          • 在数据库中查找对应 openid 是否存在
                                          const { appid, secret, grant_type } = require('../config/wx');
                                          +router.post('/login', (req, res) => {
                                          +  // 1. 获取 code
                                          +  const { code } = req.query;
                                          +  // 2. 通过 code 获取 openid 和 session_key
                                          +  const { openid } = await request.get('/sns/jscode2session', {
                                          +    appid,
                                          +    secret,
                                          +    js_code: code,
                                          +    grant_type,
                                          +  });
                                          +  // 3. 查找用户是否已经注册
                                          +  models.user
                                          +    .findOne({
                                          +      where: {
                                          +        openid,
                                          +      },
                                          +    })
                                          +    .then((user) => {
                                          +      if (user) {
                                          +        // 3.2 如果用户已经注册,返回用户信息
                                          +        res.json(
                                          +          new Result({
                                          +            data: user,
                                          +            msg: '登录成功',
                                          +          })
                                          +        );
                                          +      } else {
                                          +        // 3.3 如果用户没有注册,创建用户并返回用户信息
                                          +        const username = randomUserName();
                                          +        models.user
                                          +          .create({
                                          +            nickname: username,
                                          +            openid,
                                          +            avatar: '/uploads/default-avatar.png',
                                          +          })
                                          +          .then((user) => {
                                          +            res.json(
                                          +              new Result({
                                          +                data: user,
                                          +                msg: '登录成功',
                                          +              })
                                          +            );
                                          +          });
                                          +      }
                                          +    });
                                          +});
                                          +

                                          上面就是一个基于 code 获取 openid,并通过 openid 创建新的用户,并将创建好的用户返回。

                                          为了方便理解,这里简化描述了登录逻辑。在实际业务代码中,通常会使用 openidsession key 和用户信息来创建自定义登录凭证(token),并在登录时将用户信息和 token 一起返回给前端。前端会将 token 存储在本地,并在下一次需要登录的业务请求中携带 token,从而实现业务鉴权的功能。这种方式通常使用 JWT(JSON Web Token)等工具来实现。在后续的讲解中,我们将详细介绍这些概念和技术细节。

                                          # 1.2 手机号码快捷登录

                                          获取手机号码的前提:

                                          • 非个人小程序
                                          • 认证的小程序
                                          • 非海外的企业认证

                                          下面是大概业务流程图:

                                          # 1.2.1 获取对应 code

                                          <template>
                                          +  <button
                                          +    class="login-btn"
                                          +    open-type="getPhoneNumber"
                                          +    @getphonenumber="getPhoneNumber"
                                          +  >
                                          +    手机号码登录
                                          +  </button>
                                          +</template>
                                          +
                                          +<script>
                                          +export default {
                                          +  setup() {
                                          +    // 目前该接口针对非个人开发者,且完成了认证的小程序开放(不包含海外主体)
                                          +    const getPhoneNumber = (e) => {
                                          +      const { code, errMsg } = e.detail;
                                          +      if (errMsg === 'getPhoneNumber:ok') {
                                          +        const { data } = await loginByPhone({
                                          +          code,
                                          +        });
                                          +      } else {
                                          +        uni.showToast({
                                          +          title: errMsg,
                                          +        });
                                          +      }
                                          +    };
                                          +
                                          +    return {
                                          +      getPhoneNumber,
                                          +    };
                                          +  },
                                          +};
                                          +</script>
                                          +

                                          # 1.2.2 后端处理逻辑

                                          // 基于手机号登录
                                          +router.post('/loginByPhone', async function (req, res) {
                                          +  try {
                                          +    // 1. 获取 code 和 loginCode
                                          +    const { code } = req.body;
                                          +    // 2. 获取接口调用凭据,理论上这里需要缓存 access_token,避免频繁调用接口
                                          +    const { access_token } = await request.get('/cgi-bin/token', {
                                          +      grant_type: 'client_credential',
                                          +      appid,
                                          +      secret,
                                          +    });
                                          +    // 3. 获取手机号
                                          +    const { phone_info } = await request.post(
                                          +      `/wxa/business/getuserphonenumber?access_token=${access_token}`,
                                          +      {
                                          +        code,
                                          +      }
                                          +    );
                                          +    // 4. 查找用户是否已经注册
                                          +    // 4.1 根据 phone 查找用户
                                          +    const { purePhoneNumber } = phone_info;
                                          +    models.user
                                          +      .findOne({
                                          +        where: {
                                          +          purePhoneNumber,
                                          +        },
                                          +      })
                                          +      .then((user) => {
                                          +        if (user) {
                                          +          // 4.2 如果用户已经注册,返回用户信息
                                          +          res.json(
                                          +            new Result({
                                          +              data: user,
                                          +              msg: '登录成功',
                                          +            })
                                          +          );
                                          +        } else {
                                          +          // 4.3 如果用户没有注册,创建用户并返回用户信息
                                          +          const username = randomUserName();
                                          +          models.user
                                          +            .create({
                                          +              nickname: username,
                                          +              avatar: '/uploads/default-avatar.png',
                                          +              phone: phone_info.purePhoneNumber,
                                          +            })
                                          +            .then((user) => {
                                          +              res.json(
                                          +                new Result({
                                          +                  data: user,
                                          +                  msg: '登录成功',
                                          +                })
                                          +              );
                                          +            });
                                          +        }
                                          +      });
                                          +  } catch (error) {
                                          +    res.json(
                                          +      new Result({
                                          +        code: 'BIZ_ERROR',
                                          +        msg: error.errmsg || error.message,
                                          +      })
                                          +    );
                                          +  }
                                          +});
                                          +

                                          上面代码,实现获取手机号码并使用手机号码作为唯一标识,进行用户创建和查找的操作。

                                          从登录的角度来看,使用手机号码作为唯一标识符是没有问题的。然而,如果用户尝试使用非手机号码(例如 OpenID)进行登录,并在数据库中找不到匹配的记录时,系统会创建一个新的账号。这可能导致同一个用户在系统中存在多个账号的情况。

                                          为了优化这种情况,可以考虑以下几种方法:

                                          • 当用户使用 openid 登录后,检测未绑定手机号码时,进行号码绑定
                                          • 当用户使用手机号码登录时,提前调用 wx.login 获取对应 code,换取 openid 把他与手机号码进行关联

                                          现在基于上面的代码,采用第二种方案,只需要微调下代码就能解决这个问题。

                                          • 登录时把 wx.login 获取 code 传递给后端
                                          <template>
                                          +  <button
                                          +    class="login-btn"
                                          +    open-type="getPhoneNumber"
                                          +    @getphonenumber="getPhoneNumber"
                                          +  >
                                          +    手机号码登录
                                          +  </button>
                                          +</template>
                                          +
                                          +<script>
                                          +export default {
                                          +  setup() {
                                          +    // 目前该接口针对非个人开发者,且完成了认证的小程序开放(不包含海外主体)
                                          +    const getPhoneNumber = (e) => {
                                          +      const { code, errMsg } = e.detail;
                                          +      if (errMsg === 'getPhoneNumber:ok') {
                                          +        uni.login({
                                          +          success: async (res) => {
                                          +            if (res.errMsg === 'login:ok') {
                                          +              const { data } = await loginByPhone({
                                          +                code,
                                          +                loginCode: res.code,
                                          +              });
                                          +              userStore.setUserInfo(data);
                                          +              uni.navigateBack();
                                          +            }
                                          +          },
                                          +          fail(e) {
                                          +            uni.showToast({
                                          +              title: e.message,
                                          +            });
                                          +          },
                                          +        });
                                          +      } else {
                                          +        uni.showToast({
                                          +          title: errMsg,
                                          +        });
                                          +      }
                                          +    };
                                          +
                                          +    return {
                                          +      getPhoneNumber,
                                          +    };
                                          +  },
                                          +};
                                          +</script>
                                          +
                                          • 服务端基于 loginCode 换取 openid
                                          // 基于手机号登录
                                          +router.post('/loginByPhone', async function (req, res) {
                                          +  try {
                                          +    // 1. 获取 code 和 loginCode
                                          +    const { code, loginCode } = req.body;
                                          +
                                          +    // 2. 获取接口调用凭据,理论上这里需要缓存 access_token,避免频繁调用接口
                                          +    const { access_token } = await request.get('/cgi-bin/token', {
                                          +      grant_type: 'client_credential',
                                          +      appid,
                                          +      secret,
                                          +    });
                                          +
                                          +    // 3. 获取 openid
                                          +    const { openid } = await request.get('/sns/jscode2session', {
                                          +      appid,
                                          +      secret,
                                          +      js_code: loginCode,
                                          +      grant_type,
                                          +    });
                                          +
                                          +    // 4. 获取手机号
                                          +    const { phone_info } = await request.post(
                                          +      `/wxa/business/getuserphonenumber?access_token=${access_token}`,
                                          +      {
                                          +        code,
                                          +        openid,
                                          +      }
                                          +    );
                                          +
                                          +    // 5. 查找用户是否已经注册
                                          +    // 5.1 根据 openid 查找用户
                                          +    models.user
                                          +      .findOne({
                                          +        where: {
                                          +          openid,
                                          +        },
                                          +      })
                                          +      .then((user) => {
                                          +        if (user) {
                                          +          // 5.2 如果用户已经注册,返回用户信息
                                          +          res.json(
                                          +            new Result({
                                          +              data: user,
                                          +              msg: '登录成功',
                                          +            })
                                          +          );
                                          +        } else {
                                          +          // 5.3 如果用户没有注册,创建用户并返回用户信息
                                          +          const username = randomUserName();
                                          +          models.user
                                          +            .create({
                                          +              nickname: username,
                                          +              openid,
                                          +              avatar: '/uploads/default-avatar.png',
                                          +              phone: phone_info.purePhoneNumber,
                                          +            })
                                          +            .then((user) => {
                                          +              res.json(
                                          +                new Result({
                                          +                  data: user,
                                          +                  msg: '登录成功',
                                          +                })
                                          +              );
                                          +            });
                                          +        }
                                          +      });
                                          +  } catch (error) {
                                          +    res.json(
                                          +      new Result({
                                          +        code: 'BIZ_ERROR',
                                          +        msg: error.errmsg || error.message,
                                          +      })
                                          +    );
                                          +  }
                                          +});
                                          +

                                          这种方案被视为最佳的解决方案,能够有效解决多账号和绑定手机号码等问题。 实际上,采用哪种方式取决于具体的业务场景,因为在某些情况下,用户可能会担心手机号码泄露而不愿采用这种方式。

                                          # 1.2.3 注意

                                          • 获取手机号码是需要收费,每次调用需要 0.03 元。
                                          • wx.logingetPhoneNumber 中获取的 code 不是同一个

                                          # 总结

                                          • 基于 openid 或 手机号码快捷登录
                                          • 获取手机号码前置条件
                                          • 如何解决多账号的问题
                                          • 讲解前端、后端、微信登录过程中完整交互流程,方便更好去理解小程序登录

                                          如果您有任何疑问,请随时在评论区留言。

                                          Last Updated: 6/25/2022, 5:25:39 PM
                                            + + + diff --git a/uniapp/mini-album.html b/uniapp/mini-album.html new file mode 100644 index 0000000..f646646 --- /dev/null +++ b/uniapp/mini-album.html @@ -0,0 +1,106 @@ + + + + + + 保存图片到相册 | 点滴记录 + + + + + + + + +

                                            保存图片到相册

                                            # 保存图片到相册

                                            同 APP 一样,小程序本身也是原生作为它的宿主环境。对于不同来源的图片,保存方式上存在差异。

                                            • 网络图片
                                            uni.downloadFile({
                                            +  url: 'https://www.example.com/file/test', //仅为示例,并非真实的资源
                                            +  success: (res) => {
                                            +    if (res.statusCode === 200) {
                                            +      uni.saveImageToPhotosAlbum({
                                            +        filePath: res.tempFilePath,
                                            +        success() {
                                            +          console.log('save success');
                                            +        },
                                            +      });
                                            +    }
                                            +  },
                                            +});
                                            +
                                            • 本地图片(相册、相机)
                                            // 单张
                                            +uni.chooseImage({
                                            +  count: 1,
                                            +  sourceType: ['camera'],
                                            +  success: function (res) {
                                            +    uni.saveImageToPhotosAlbum({
                                            +      filePath: res.tempFilePaths[0],
                                            +      success: function () {
                                            +        console.log('save success');
                                            +      },
                                            +    });
                                            +  },
                                            +});
                                            +
                                            +// 批量
                                            +uni.chooseImage({
                                            +  count: 2,
                                            +  sourceType: ['camera'],
                                            +  success: function (res) {
                                            +    const tempFilePaths = res.tempFilePaths;
                                            +    const len = tempFilePathss.length;
                                            +    for (let i = 0; i < len; i++) {
                                            +      uni.saveImageToPhotosAlbum({
                                            +        filePath: tempFilePaths[i],
                                            +        success: function () {
                                            +          console.log('保存成功');
                                            +        },
                                            +        fail: function () {
                                            +          console.log('保存失败');
                                            +        },
                                            +      });
                                            +    }
                                            +  },
                                            +});
                                            +
                                            • Canvas

                                            在小程序中基本上海报功能是一个常见的需求,涉及保存到相册就显得很常见。 小程序中提供了对应 API uni.canvasToTempFilePath (opens new window) 。把 Canvas 转换为临时文件目录,本质猜测底层跟 App 实现原理一样,先转换为 Base64 再使用 Bitmap 转为临时目录。

                                            具体代码实现如下:

                                            uni.canvasToTempFilePath({
                                            +  canvasId: 'canvas', // canvasId
                                            +  success: function (res) {
                                            +    uni.saveImageToPhotosAlbum({
                                            +      filePath: res.tempFilePath,
                                            +      success: function () {
                                            +        console.log('保存成功');
                                            +      },
                                            +      fail: function () {
                                            +        console.log('保存失败');
                                            +      },
                                            +    });
                                            +  },
                                            +  fail: function () {
                                            +    console.log('保存失败');
                                            +  },
                                            +});
                                            +
                                            Last Updated: 9/1/2024, 6:28:54 PM
                                              + + + diff --git a/uniapp/open-app.html b/uniapp/open-app.html new file mode 100644 index 0000000..f18bb2d --- /dev/null +++ b/uniapp/open-app.html @@ -0,0 +1,129 @@ + + + + + + H5 打开 APP 并跳转具体页面 | 点滴记录 + + + + + + + + +

                                              H5 打开 APP 并跳转具体页面

                                              # H5 打开 APP 并跳转具体页面

                                              要想打开一个 APP 并跳转具体页面 ,大概准备如下:

                                              • 配置 APP 的 URL Scheme
                                              • H5 与 APP 约定参数传递方式,APP 侧在应用的入口根据参数格式解析参数
                                              • APP 根据参数跳转到相应的页面

                                              # 配置 URL Scheme

                                              打开 manifest.json ,找到 APP常用其它配置选项, 找到对应的 UrlSchemes

                                              UrlSchemes 可以知道,它支持为应用配置多个 Scheme 。

                                              # 应用解析参数

                                                // App.vue
                                              +  /**
                                              +	* 解析启动参数
                                              +	* 约定参数格式
                                              +	* runtest://?page=qsdetail&questionId=${this.questionId}
                                              +	*/
                                              +	function parseLaunchParams(){
                                              +		//#ifdef APP-PLUS
                                              +
                                              +      // IOS 需要添加延迟,否则 plus.runtime.arguments 永远访问到的是上一次值。
                                              +			setTimeout(() => {
                                              +				const regx = /^runtest:\/\/\?/;
                                              +				if(plus.runtime.arguments && regx.test(plus.runtime.arguments)){
                                              +					const queryString = plus.runtime.arguments.split(regx)[1];
                                              +					const query = qs.parse(queryString);
                                              +          // 根据页面参数跳转到不同的页面。
                                              +					if(query.page === 'qsdetail'){
                                              +						setTimeout(()=> {
                                              +							router.push({
                                              +								name: 'qsdetail',
                                              +								params: {
                                              +									id: query.questionId
                                              +								}
                                              +							});
                                              +						}, 500)
                                              +					}
                                              +          // 这里清空目的,防止参数多次服用。
                                              +					plus.runtime.arguments = null;
                                              +					plus.runtime.arguments = '';
                                              +				}
                                              +			})
                                              +		//#endif
                                              +	}
                                              +
                                              +  export default {
                                              +    ...,
                                              +    onShow(){
                                              +      //#ifdef APP-PLUS
                                              +				parseLaunchParams();
                                              +			//#endif
                                              +    },
                                              +    ...
                                              +  }
                                              +

                                              # H5 跳转

                                              <a href="runtest://?page=qsdetail">openApp</a>
                                              +

                                              # 在未安装应用时跳转到下载页

                                              理想情况用户都安装 APP,在很多时候我们并不知道用户是否已经安装某个应用,当未成功跳转时,则跳转至下载页面。

                                              针对上面的方式做下调整,把跳转逻辑换成事件处理的方式。

                                              
                                              +  // app 下载器
                                              +	let appDownload;
                                              +  // 通用协议地址
                                              +  let commSchemeUrl = "runtest://?page=qsdetail";
                                              +  // iOS 下载地址
                                              +  let iOSDownloadUrl = "https://itunes.apple.com/cn/app/";
                                              +  // Android 下载地址
                                              +  let androidDownloadUrl = "Android 下载地址"
                                              +
                                              +  function openApp() {
                                              +    let u = navigator.userAgent;
                                              +    let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //判断是否是 android终端
                                              +    let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //判断是否是 iOS终端
                                              +    // 首次尝试打开 App 并跳转
                                              +    if (isAndroid || isIOS) {
                                              +      window.location.href = commSchemeUrl;
                                              +    }
                                              +    // 3ms 后没打开,直接跳转对应下载页面
                                              +    appDownload = setTimeout(function() {
                                              +      if (isAndroid) {
                                              +        window.location.href = androidDownloadUrl;
                                              +      } else if (isIOS) {
                                              +        window.location.href = iOSDownloadUrl;
                                              +      }
                                              +    }, 3000);
                                              +  }
                                              +
                                              +  document.addEventListener('visibilitychange webkitvisibilitychange', function() {
                                              +    // 如果页面隐藏,认为打开 app,清除下载任务
                                              +    if (document.hidden || document.webkitHidden) {
                                              +      clearTimeout(appDownload)
                                              +    }
                                              +  })
                                              +  window.addEventListener('pagehide', function() {
                                              +    clearTimeout(appDownload)
                                              +  })
                                              +

                                              # 问题

                                              • IOS 下 plus.runtime.arguments 不能获取到 URL Scheme 协议参数

                                              检查 pages.json 中是不是有 condition 这个节点(非常重要)

                                              • IOS 下 plus.runtime.arguments 获取到的都是上一次的值

                                              需要通过 setTimeout 来解决,代码如下

                                              onShow() {
                                              +  setTimeout(function(){
                                              +      console.log(plus.runtime.arguments)
                                              +      console.log(plus.runtime.launcher)
                                              +  },0);
                                              +}
                                              +

                                              # 参考文档

                                              Last Updated: 6/25/2022, 5:25:39 PM
                                                + + + diff --git a/uniapp/open-id.html b/uniapp/open-id.html new file mode 100644 index 0000000..34f8465 --- /dev/null +++ b/uniapp/open-id.html @@ -0,0 +1,57 @@ + + + + + + 静默获取 openId | 点滴记录 + + + + + + + + +

                                                静默获取 openId

                                                # 静默获取 openId

                                                # openId 是什么?

                                                用户在当前小程序的唯一标识(openid)。

                                                # 小程序中如何获取 openId

                                                小程序端伪代码如下:

                                                wx.login({
                                                +  success(res){
                                                +    if(res.code){
                                                +      wx.request({
                                                +        url: "https://example.com/api/login",
                                                +        data: {
                                                +          code: res.code
                                                +        },
                                                +        success(res){
                                                +          // 存储自定义的登录状态;例如 token
                                                +        }
                                                +      })
                                                +    }
                                                +  }
                                                +})
                                                +

                                                # 说明

                                                • 调用 wx.login() (opens new window) 获取 临时登录凭证code ,并回传到开发者服务器。
                                                • 调用 auth.code2Session (opens new window) 接口,换取 用户唯一标识 OpenID 、 用户在微信开放平台帐号下的唯一标识UnionID(若当前小程序已绑定到微信开放平台帐号) 和 会话密钥 session_key。

                                                # 注意事项

                                                • 会话密钥 session_key 是对用户数据进行 加密签名 (opens new window) 的密钥。为了应用自身的数据安全,开发者服务器不应该把会话密钥下发到小程序,也不应该对外提供这个密钥
                                                • 临时登录凭证 code 只能使用一次
                                                Last Updated: 6/25/2022, 5:25:39 PM
                                                  + + + diff --git a/uniapp/pay.html b/uniapp/pay.html new file mode 100644 index 0000000..e34b4cd --- /dev/null +++ b/uniapp/pay.html @@ -0,0 +1,45 @@ + + + + + + 支付功能 | 点滴记录 + + + + + + + + +

                                                  支付功能

                                                  # 支付功能

                                                  接入支付应该很常见的业务需求,本篇文章将把常见支付渠道流程进行梳理并实现。

                                                  uniapp 中要实现支付还是简单,目前他提供两种模式:

                                                  • requestPayment + 服务端开发(自定义)
                                                  • requestPayment + uniCloud(云服务) + uniPay

                                                  不管 自定义uniCloud 的作用都是对接第三方的平台。 只不过使用 uniCloud 服务,可以直接使用 uniPay 工具,它封装对第三方支付的服务。可以大大提高支付业务的开发效率。这也是官方推荐使用的方式。

                                                  目前常用支付方式有:微信支付宝苹果支付。 这也是 uniappPayment Plugin 提供支持的几种方式。

                                                  虽然 uniapp 提供开箱即用的 uni.requestPayment (opens new window) API 供我们在不同客户的调用支付,但是了解每种支付的流程也是很有必要的,这样可以更好的使用和排查问题。

                                                  接下来一一分析各个支付流程。

                                                  # 支付宝

                                                  # 支付宝订单详细结构图

                                                  # 客户端大概交互流程

                                                  在流程熟悉后,现基于 uniapp 提供的 Payment 插件, 使用提供 uni.requestPayment(OBJECT) (opens new window) 来完成支付功能。

                                                  在使用 API 之前,需要做一些配置工作。 在 manifest.json 中添加配置

                                                  在可视化配置界面中勾选 ☑️ Payment(支付),如下:

                                                  勾选之后,源码视图中可以看到如下:

                                                   "payment" : {
                                                  +      "alipay" : {
                                                  +          "__platform__" : [ "ios", "android" ]
                                                  +      }
                                                  +  },
                                                  +

                                                  此时表示配置成功了,接下来进入到实际的业务代码编写。

                                                  Last Updated: 9/1/2024, 6:28:54 PM
                                                    + + + diff --git a/uniapp/persistence.html b/uniapp/persistence.html new file mode 100644 index 0000000..cc55992 --- /dev/null +++ b/uniapp/persistence.html @@ -0,0 +1,38 @@ + + + + + + 本地持久化 | 点滴记录 + + + + + + + + +

                                                    本地持久化

                                                    # 本地持久化

                                                    Last Updated: 6/25/2022, 5:25:39 PM
                                                      + + + diff --git a/uniapp/poster.html b/uniapp/poster.html new file mode 100644 index 0000000..9acfa5c --- /dev/null +++ b/uniapp/poster.html @@ -0,0 +1,42 @@ + + + + + + 海报分享 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/request.html b/uniapp/request.html new file mode 100644 index 0000000..fd53837 --- /dev/null +++ b/uniapp/request.html @@ -0,0 +1,396 @@ + + + + + + 请求库封装 | 点滴记录 + + + + + + + + +

                                                      请求库封装

                                                      # 请求库封装

                                                      # 背景

                                                      在前端开发中,HTTP 请求是与服务器进行数据交互的核心手段。无论是获取数据还是提交数据,前端应用几乎都离不开 HTTP 请求。在 uniapp 中,uni.request 是官方提供的用于发起 HTTP 请求的基础 API。然而,直接使用 uni.request 存在一些问题和不足,比如:

                                                      1. 代码冗余:每次发起请求时都需要编写类似的配置代码,导致代码重复。
                                                      2. 缺乏统一管理:没有统一的地方管理请求参数、头信息、错误处理等,使得代码不易维护

                                                      # 意义

                                                      • 简化请求配置:在每次发起请求时,通常需要配置很多参数,比如 URL、请求头、请求体等。通过封装请求库,可以设置默认的请求参数,简化每次请求的配置操作,减少开发人员的工作量,提高开发效率。
                                                      • 管理请求凭证:通过封装请求库,可以集中管理凭证,确保每次请求都自动携带正确的凭证。
                                                      • 便于维护和扩展:封装请求库后,如果需要对请求逻辑进行修改或扩展,只需要在封装库中进行调整,而不需要在项目的各个地方逐一修改。此外,如果需要将请求库更换为其他库(例如 Axios),只需修改封装的请求库部分,而无需改动业务代码。
                                                      • 提高用户体验:通过统一处理全局请求 Loading 状态,可以在请求进行中显示加载提示,提升用户体验。

                                                      # 实现思路

                                                      # 1. 把 uni.request 改为支持 Promise 调用方式

                                                      uni.request 改为支持 Promise 调用方式的好处是可以避免回调嵌套问题,并且可以借助 async/await 实现同步调用。

                                                      实现方式大概有如下两种:

                                                      # 1.1 通过 uni 自身提供的方法

                                                      调用 uni.request 时,如果不传入 successfailcomplete 回调函数,uni.request 的返回值将是一个 Promise 对象。

                                                      uni
                                                      +  .request({
                                                      +    url: '',
                                                      +    // ... 其他配置
                                                      +  })
                                                      +  .then(() => {})
                                                      +  .catch(() => {})
                                                      +  .finally(() => {});
                                                      +

                                                      # 1.2 通过 Promise 包装

                                                      new Promise((resolve, reject) => {
                                                      +  uni.request({
                                                      +    url: '',
                                                      +    success(res) {
                                                      +      resolve(res);
                                                      +    },
                                                      +    fail(error) {
                                                      +      reject(error);
                                                      +    },
                                                      +    complete() {},
                                                      +  });
                                                      +});
                                                      +

                                                      具体采用哪种方式都可以,这里选择第一种。

                                                      # 2. 定义默认请求参数

                                                      在请求时,通常需要设置 content-typetimeout 等信息。这些参数通常不会改变,因此可以设计为默认参数,同时保留外部覆盖默认参数值的能力。

                                                      # 2.1 定义默认参数

                                                      // 定义默认参数
                                                      +const defaultOptions = {
                                                      +  timeout: 15000,
                                                      +  dataType: 'json',
                                                      +  header: {
                                                      +    'content-type': 'application/json',
                                                      +  },
                                                      +};
                                                      +

                                                      # 2.2 合并外部参数与默认参数

                                                      提供外部覆盖默认参数值的能力

                                                      const defaultConfig = {
                                                      +  timeout: 15000,
                                                      +  dataType: 'json',
                                                      +  header: {
                                                      +    'content-type': 'application/json',
                                                      +  },
                                                      +};
                                                      +const wrapRequest = ({
                                                      +  url = '',
                                                      +  data = {},
                                                      +  method = 'GET',
                                                      +  header = {},
                                                      +} = {}) => {
                                                      +  return uni.request({
                                                      +    ...defaultConfig,
                                                      +    url,
                                                      +    data,
                                                      +    method,
                                                      +    header: {
                                                      +      ...defaultOptions.header,
                                                      +      ...header,
                                                      +    },
                                                      +  });
                                                      +};
                                                      +

                                                      # 3. 统一处理请求凭证

                                                      在大多数系统中,接口请求通常需要传递用户凭证。通常的做法是在请求的 Header 中添加 Authorization 属性。为了简化这个过程,可以通过拦截器来实现。

                                                      const TOKEN_KEY = 'token';
                                                      +
                                                      +// 处理 token
                                                      +const handleToken = (config) => {
                                                      +  const token = uni.getStorageSync(TOKEN_KEY);
                                                      +  if (token) {
                                                      +    config.header.Authorization = token;
                                                      +  }
                                                      +};
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    handleToken(config);
                                                      +  },
                                                      +});
                                                      +

                                                      另外,系统通常会有多个环境。在这种情况下,可以根据不同的环境设置不同的 BASE_URL,这也可以通过拦截器来实现。

                                                      const BASE_URL = '';
                                                      +
                                                      +const handleURL = (config) => {
                                                      +  const { url } = config;
                                                      +  if (!/https|http/.test(url)) {
                                                      +    config.url = url.startsWith('/')
                                                      +      ? `${BASE_URL}${url}`
                                                      +      : `${BASE_URL}/${url}`;
                                                      +  }
                                                      +};
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    handleURL(config);
                                                      +  },
                                                      +});
                                                      +

                                                      如果有其他处理需求,可以直接在这里添加。

                                                      # 4. 统一处理公共响应状态码

                                                      为了避免在多个地方处理公共的错误逻辑,例如凭证无效时跳转到登录页、移除本地 token 等,我们可以在全局请求响应拦截器中集中处理这些问题。

                                                      const LOGIN_INVALID_CODE_LIST = ['INVALID_TOKEN', 'EXPIRED_TOKEN'];
                                                      +const SUCCESS = 'SUCCESS';
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  success(res) {
                                                      +    const { data: resData } = res;
                                                      +    const { code, message } = resData;
                                                      +    if (code !== SUCCESS) {
                                                      +      // 如果响应代码在登录无效代码列表中
                                                      +      if (LOGIN_INVALID_CODE_LIST.includes(code)) {
                                                      +        uni.showToast({
                                                      +          title: message,
                                                      +          icon: 'none',
                                                      +        });
                                                      +        uni.navigateTo({
                                                      +          url: '/pages/login/login',
                                                      +        });
                                                      +        return;
                                                      +      } else {
                                                      +        // 处理其他错误代码
                                                      +        return Promise.reject(resData);
                                                      +      }
                                                      +    }
                                                      +    return Promise.resolve(resData);
                                                      +  },
                                                      +});
                                                      +

                                                      # 5. 封装公共方法 GET、POST、DEL、PUT

                                                      为了进一步简化请求参数,可以提供一系列方法,例如 GETPOSTDELETEPUT

                                                      export const get = (params) => wrapRequest({ ...params, method: 'GET' });
                                                      +export const post = (params) => wrapRequest({ ...params, method: 'POST' });
                                                      +export const put = (params) => wrapRequest({ ...params, method: 'PUT' });
                                                      +export const del = (params) => wrapRequest({ ...params, method: 'DELETE' });
                                                      +

                                                      这样做的好处,它消除了每次调用时显式传入 HTTP 方法的需要,使代码更简洁、更易读。这样做的好处是你在调用这些方法时只需关注请求参数,而不需要重复指定 HTTP 方法。

                                                      # 6. 定义全局请求 Loading

                                                      在正常情况下,我们的接口通常会很快完成。然而,考虑到不同网络状况下,接口响应速度可能会变慢,从而增加用户的等待时间。为了优化用户体验,我们可以在全局请求中添加 Loading 提示,这将大大提升用户体验。

                                                      const showLoading = () => {
                                                      +  uni.showLoading({
                                                      +    title: '加载中',
                                                      +  });
                                                      +};
                                                      +
                                                      +const hideLoading = () => {
                                                      +  uni.hideLoading();
                                                      +};
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (request) {
                                                      +    showLoading();
                                                      +    return request;
                                                      +  },
                                                      +  complete() {
                                                      +    hideLoading();
                                                      +  },
                                                      +});
                                                      +

                                                      这样每个接口请求时都会触发显示 Loading。考虑到某些接口可能不需要显示 Loading,我们可以允许用户在定义接口时明确控制是否展示 Loading

                                                      const showLoading = (loading) => {
                                                      +  uni.showLoading({
                                                      +    title: '加载中',
                                                      +  });
                                                      +};
                                                      +
                                                      +const hideLoading = (loading) => {
                                                      +  uni.hideLoading();
                                                      +};
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    if (config.loading) {
                                                      +      showLoading();
                                                      +    }
                                                      +    return request;
                                                      +  },
                                                      +  complete() {
                                                      +    hideLoading();
                                                      +  },
                                                      +});
                                                      +
                                                      +const wrapRequest = ({
                                                      +  url = '',
                                                      +  data = {},
                                                      +  method = 'GET',
                                                      +  header = {},
                                                      +  loading = true, // 默认是展示 loading
                                                      +} = {}) => {
                                                      +  return uni.request({
                                                      +    ...defaultConfig,
                                                      +    url,
                                                      +    data,
                                                      +    method,
                                                      +    loading,
                                                      +    header: {
                                                      +      ...defaultOptions.header,
                                                      +      ...header,
                                                      +    },
                                                      +  });
                                                      +};
                                                      +

                                                      为了解决接口请求很快时 Loading 闪烁的问题,我们可以添加一个延迟参数。如果请求时间超过 50ms(具体阀值可以自己去定义) 才显示 Loading,否则就不展示:

                                                      const LOADING_DELAY = 50; // 50ms 延迟
                                                      +let loadingTimer;
                                                      +
                                                      +const showLoading = () => {
                                                      +  uni.showLoading({
                                                      +    title: '加载中',
                                                      +  });
                                                      +};
                                                      +
                                                      +const hideLoading = () => {
                                                      +  uni.hideLoading();
                                                      +};
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    if (config.loading) {
                                                      +      loadingTimer = setTimeout(showLoading, LOADING_DELAY);
                                                      +    }
                                                      +    return config;
                                                      +  },
                                                      +  complete() {
                                                      +    clearTimeout(loadingTimer);
                                                      +    hideLoading();
                                                      +  },
                                                      +});
                                                      +

                                                      # 7. 完整代码如下

                                                      const defaultOptions = {
                                                      +  timeout: 15000,
                                                      +  dataType: 'json',
                                                      +  header: {
                                                      +    'content-type': 'application/json',
                                                      +  },
                                                      +};
                                                      +const TOKEN_KEY = 'token';
                                                      +const BASE_URL = '';
                                                      +const LOGIN_INVALID_CODE_LIST = ['INVALID_TOKEN', 'EXPIRED_TOKEN'];
                                                      +const SUCCESS = 'SUCCESS';
                                                      +const LOADING_DELAY = 50; // 50ms 延迟
                                                      +let loadingTimer;
                                                      +
                                                      +const handleURL = (config) => {
                                                      +  const { url } = config;
                                                      +  if (!/https|http/.test(url)) {
                                                      +    config.url = url.startsWith('/')
                                                      +      ? `${BASE_URL}${url}`
                                                      +      : `${BASE_URL}/${url}`;
                                                      +  }
                                                      +};
                                                      +
                                                      +const handleToken = (config) => {
                                                      +  const token = uni.getStorageSync(TOKEN_KEY);
                                                      +  if (token) {
                                                      +    config.header.Authorization = token;
                                                      +  }
                                                      +};
                                                      +
                                                      +const showLoading = () => {
                                                      +  uni.showLoading({
                                                      +    title: '加载中',
                                                      +  });
                                                      +};
                                                      +
                                                      +const hideLoading = () => {
                                                      +  uni.hideLoading();
                                                      +};
                                                      +
                                                      +uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    if (config.loading) {
                                                      +      loadingTimer = setTimeout(showLoading, LOADING_DELAY);
                                                      +    }
                                                      +    handleURL(config);
                                                      +    handleToken(config);
                                                      +  },
                                                      +  success(res) {
                                                      +    const { data: resData } = res;
                                                      +    const { code, message } = resData;
                                                      +    if (code !== SUCCESS) {
                                                      +      // 如果响应代码在登录无效代码列表中
                                                      +      if (LOGIN_INVALID_CODE_LIST.includes(code)) {
                                                      +        uni.showToast({
                                                      +          title: message,
                                                      +          icon: 'none',
                                                      +        });
                                                      +        uni.navigateTo({
                                                      +          url: '/pages/login/login',
                                                      +        });
                                                      +        return;
                                                      +      } else {
                                                      +        // 处理其他错误代码
                                                      +        return Promise.reject(resData);
                                                      +      }
                                                      +    }
                                                      +    return Promise.resolve(resData);
                                                      +  },
                                                      +  complete() {
                                                      +    clearTimeout(loadingTimer);
                                                      +    hideLoading();
                                                      +  },
                                                      +});
                                                      +
                                                      +const wrapRequest = ({
                                                      +  url = '',
                                                      +  data = {},
                                                      +  method = 'GET',
                                                      +  header = {},
                                                      +  loading = true,
                                                      +} = {}) => {
                                                      +  return uni.request({
                                                      +    ...defaultOptions,
                                                      +    url,
                                                      +    data,
                                                      +    method,
                                                      +    loading,
                                                      +    header: {
                                                      +      ...defaultOptions.header,
                                                      +      ...header,
                                                      +    },
                                                      +  });
                                                      +};
                                                      +
                                                      +export const get = (params) => wrapRequest({ ...params, method: 'GET' });
                                                      +export const post = (params) => wrapRequest({ ...params, method: 'POST' });
                                                      +export const put = (params) => wrapRequest({ ...params, method: 'PUT' });
                                                      +export const del = (params) => wrapRequest({ ...params, method: 'DELETE' });
                                                      +

                                                      # 8. 测试

                                                      import { get } from '@/utils/request';
                                                      +
                                                      +get({
                                                      +  url: 'https://api.aigcway.com/aigc/chat-category/list',
                                                      +}).then((res) => {
                                                      +  console.log(res);
                                                      +});
                                                      +

                                                      输出如下:

                                                      {
                                                      +    "code": "SUCCESS",
                                                      +    "message": "操作成功",
                                                      +    "data": []
                                                      +}
                                                      +

                                                      # 总结

                                                      我们完成了一个通用请求库的封装,这基本上可以满足大多数业务需求。在具体请求中,状态码处理可以根据自身业务需求进行调整。

                                                      为了掌握上面的内容,需要掌握 uni.addInterceptoruni.request 执行的完整流程。以下是整理的不同情况下的流程图,可以参考学习。

                                                      上面流程图对应示例代码:

                                                      uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    console.log('interceptor invoke');
                                                      +  },
                                                      +  success(res) {
                                                      +    console.log('interceptor success');
                                                      +  },
                                                      +  complete() {
                                                      +    console.log('interceptor complete');
                                                      +  },
                                                      +});
                                                      +uni
                                                      +  .request({
                                                      +    url: '',
                                                      +  })
                                                      +  .then(() => {
                                                      +    console.log('then');
                                                      +  })
                                                      +  .catch(() => {
                                                      +    console.log('catch');
                                                      +  })
                                                      +  .finally(() => {
                                                      +    console.log('finally');
                                                      +  });
                                                      +

                                                      上面流程图对应示例代码:

                                                      uni.addInterceptor('request', {
                                                      +  invoke: function (config) {
                                                      +    console.log('interceptor invoke');
                                                      +  },
                                                      +  success(res) {
                                                      +    console.log('interceptor success');
                                                      +  },
                                                      +  complete() {
                                                      +    console.log('interceptor complete');
                                                      +  },
                                                      +});
                                                      +uni.request({
                                                      +  success() {
                                                      +    console.log('success');
                                                      +  },
                                                      +  fail() {
                                                      +    console.log('fail');
                                                      +  },
                                                      +  complete() {
                                                      +    console.log('complete');
                                                      +  },
                                                      +});
                                                      +
                                                      Last Updated: 9/1/2024, 8:19:59 PM
                                                        + + + diff --git a/uniapp/router.html b/uniapp/router.html new file mode 100644 index 0000000..0a64d26 --- /dev/null +++ b/uniapp/router.html @@ -0,0 +1,88 @@ + + + + + + 路由 | 点滴记录 + + + + + + + + +

                                                        路由

                                                        # 路由

                                                        # 为什么使用 uni-simple-router

                                                        uniapp 只提供基础路由的功能,能满足日常简单业务需求。往往实际的业务场景都会比较复杂,例如涉及权限的管控,哪些页面只能登录后访问。

                                                        针对这样的需求,在不引入外部插件的情况下,能想到的就是在页面级别的钩子中去完成,比如 onLoad 中。 假设控制页面很多,可能需要在每个页面中添加对应鉴权逻辑。 为了减少代码重复,可以通过 mixins 的方式共用其鉴权的逻辑。这些都不是理想的处理方式。 为什么? 首先 minxins 并不够直观,这也就是 vue3 放弃它的一个原因之一。其次一般页面级别守卫通常针对当前页面设计,并不能把全局(应用)级别控制的放入进来。

                                                        有没有像 Vue-router 那样,既支持页面级、以及全局的守卫功能,答案有,也就是 uni-simple-router (opens new window)

                                                        uni-simple-router 官方对其介绍如下:

                                                        • 首先属于它是 uniapp 的一个插件
                                                        • 简明优先 (语法同 vue-router 一样)
                                                        • 多端发布 (开发者编写一套代码可发布到多个平台)

                                                        现在开始使用它吧。

                                                        # 快速上手

                                                        参考官网提供快速上手 (opens new window)

                                                        # 跨平台注意事项

                                                        针对小程序的原生组件比如 tabbarheader 这些动作出发页面跳转时,uni-simple-router 是没办法拦截的,如果需要拦截这些页面,只能通过自定义 tabbarheader 的方式来实现。

                                                        同样针对不同的端,也会有些注意事项:

                                                        • H5 端

                                                        在不考虑跨端的情况下,uni-simple-router 完成可以像使用 vue-router 的方式来使用它。

                                                        • APP 端

                                                        如果APP首页是通过 nvue 的方式,您需要使用 vue 来替代它,同时你需要在 manifest.json 下把 App常用其他设置 中的 fast启动模式 关闭掉。打开源码视图对比以下配置:

                                                        // 在源码视图下的 app-plus 节点下
                                                        +"splashscreen" : {
                                                        +    "alwaysShowBeforeRender" : false,
                                                        +    "waiting" : true,
                                                        +    "autoclose" : false,
                                                        +    "delay" : 0
                                                        +}
                                                        +

                                                        # 导航方式

                                                        按照编写方式不同,分为: 组件式导航编程式路由

                                                        # 组件式导航

                                                        顾名思义通过组件来进行页面跳转,同时为了兼容小程序,组件需要在 main.js 中引入并注册

                                                        // main.js
                                                        +import Mylink from './node_modules/uni-simple-router/dist/link.vue'
                                                        +Vue.component('my-link',Mylink)
                                                        +

                                                        使用:

                                                        <!-- 一个简单的name跳转 -->
                                                        +<my-link to="{name: 'tabbar-4',params: {name: 'my-link'}}">
                                                        +  <button type="primary">使用name对象跳转</button>
                                                        +</my-link>
                                                        +

                                                        # 编程式路由

                                                        uni-simple-router uni-app 描述
                                                        router.push() uni.navigateTo() 会在页面栈中添加路由记录。 注意事项,当提供了 path 时,则会忽略 params。同样提供 name 时,则会忽略 query。 通常 query 提供查询参,params 提供动态路由参数
                                                        router.replace() uni.redirectTo() 使用方式通过 push 一样,但是它不会在页面栈中新增记录,只会替换栈中当前记录信息。
                                                        router.replaceAll() uni.reLaunch() 将所有的页面都关掉,打开一个新的页面
                                                        router.pushTab() uni.switchTab() 打开 uni-app 自带的tab 菜单
                                                        router.back(n,{...}) uni.navigateBack() 这个方法的参数是一个正整数,意思是在 history 记录中后退多少步,类似 window.history.go(n)

                                                        # 路由传参

                                                        • 动态路由时传参注意事项

                                                        通常路由支持 动态路由通配符 以及 全路径 的方式。 不同的路由方式在使用时,需要注意。当使用 uni 提供的 API 来进行动态路由跳转时,系统会出现警告。 正常的做法如下:

                                                        // pages.json
                                                        +{
                                                        +	"pages": [
                                                        +    {
                                                        +        "path": "pages/page2/page2",
                                                        +        "aliasPath":"/page2/:id",
                                                        +        "name":"page2"
                                                        +    }
                                                        +  ]
                                                        +}
                                                        +
                                                        // 跳转方式
                                                        +this.$Router.push({
                                                        +  name:'page2',
                                                        +  params:{
                                                        +    id:12
                                                        +  }
                                                        +})
                                                        +

                                                        除了跳转之外,获取动态参数也需要注意,通常获取参数都是 onLoad 中的 options 。如果当前路由是动态参数时,uni-app 是不能正确解析,那么只能通过如下方式获取:

                                                        export default {
                                                        +  onLoad(options){
                                                        +    console.log(options); // {}
                                                        +    console.log(this.$Route); // { id: 12}
                                                        +  }
                                                        +}
                                                        +

                                                        # 导航守卫( 路由守卫 )

                                                        # 全局路由守卫

                                                        钩子 描述
                                                        router.beforeEach() 全局导航前置钩子
                                                        router.afterEach() 全局导航后置钩子

                                                        # 路由独享的守卫

                                                        钩子 描述
                                                        beforeEnter 全局导航前置钩子

                                                        # 组件内的守卫

                                                        钩子 描述
                                                        beforeRouteLeave 在组件内配置

                                                        # 插件构建时的守卫

                                                        const router = createRouter({
                                                        +    platform: process.env.VUE_APP_PLATFORM,
                                                        +    routerBeforeEach:(to, from, next) => {
                                                        +        // 每次导航触发前都会执行这个,比所有守卫都先执行
                                                        +        next();
                                                        +    },
                                                        +    routerAfterEach:(to, from) => {
                                                        +        // 跳转结束后执行 守卫守卫执行完毕后再执行
                                                        +    },
                                                        +    routerErrorEach:(error, router)=>{
                                                        +        // 跳转时错误后执行的守卫
                                                        +    }
                                                        +})
                                                        +

                                                        # 完整的导航解析流程

                                                        1. 导航被触发。

                                                        2. 调用插件 routerBeforeEach 钩子

                                                        3. 在失活的组件里调用离开守卫 beforeRouteLeave

                                                        4. 调用全局的 beforeEach 守卫。

                                                        5. 在路由配置里调用 beforeEnter

                                                        6. 导航被确认。

                                                        7. 调用全局的 afterEach 钩子。

                                                        8. 调用插件 routerAfterEach 钩子

                                                        9. H5端 触发 DOM 更新,其他端 底层调用 uni Api

                                                        Last Updated: 6/25/2022, 5:25:39 PM
                                                          + + + diff --git a/uniapp/schemes.html b/uniapp/schemes.html new file mode 100644 index 0000000..8993784 --- /dev/null +++ b/uniapp/schemes.html @@ -0,0 +1,38 @@ + + + + + + 配置 Android 、iOS 渠道 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/scope.html b/uniapp/scope.html new file mode 100644 index 0000000..4e54f3f --- /dev/null +++ b/uniapp/scope.html @@ -0,0 +1,42 @@ + + + + + + 获取权限 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/set-navigation-bar-title.html b/uniapp/set-navigation-bar-title.html new file mode 100644 index 0000000..bdab2b2 --- /dev/null +++ b/uniapp/set-navigation-bar-title.html @@ -0,0 +1,39 @@ + + + + + + 动态设置导航 | 点滴记录 + + + + + + + + +

                                                          动态设置导航

                                                          # 动态设置导航

                                                          uni.setNavigationBarTitle({ title: ''})
                                                          +
                                                          Last Updated: 6/25/2022, 5:25:39 PM
                                                            + + + diff --git a/uniapp/state.html b/uniapp/state.html new file mode 100644 index 0000000..d7588d9 --- /dev/null +++ b/uniapp/state.html @@ -0,0 +1,91 @@ + + + + + + 状态管理 | 点滴记录 + + + + + + + + +

                                                            状态管理

                                                            # 状态管理

                                                            # 安装 pinia-plugin-persistedstate

                                                            npm i pinia-plugin-persistedstate -S

                                                            # 定义 Store

                                                            import { createPinia } from 'pinia';
                                                            +import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
                                                            +
                                                            +const store = createPinia();
                                                            +store.use(piniaPluginPersistedstate);
                                                            +export default store;
                                                            +

                                                            # 引入 Store

                                                            import { createSSRApp } from 'vue';
                                                            +import App from './App.vue';
                                                            +import Store from '@/store/index.js';
                                                            +
                                                            +export function createApp() {
                                                            +  const app = createSSRApp(App);
                                                            +  app.use(Store);
                                                            +  return {
                                                            +    app,
                                                            +  };
                                                            +}
                                                            +

                                                            # 持久化

                                                            默认情况下,pinia 的状态是瞬时的,这意味着在应用刷新或重新打开时,状态会丢失。然而,对于某些用户信息,如登录凭证,我们需要将其持久化存储,以便在后续请求中使用。

                                                            pinia-plugin-persistedstate 是专为 pinia 设计的持久化插件,默认情况下使用 localStorage 进行存储。然而,在小程序或 APP 中并没有 localStorage 对象的支持。

                                                            好在 pinia-plugin-persistedstate 支持传入自定义的 storage 对象。

                                                            为在 H5小程序APP 中统一使用持久化存储,你可以通过自定义 storage 来实现。在自定义 storage 时,需要知道 storage 对象需要什么。

                                                            # storage 定义

                                                            type StorageLike = Pick<Storage, 'getItem' | 'setItem'>;
                                                            +

                                                            也就是只需要提供一个 getset方法即可。

                                                            # 实现自定义 Storage

                                                            在不同的上下文中,uni.getStorageSync 会调用相应的存储 API,因此可以直接使用它来实现自定义存储。

                                                            import { defineStore } from 'pinia';
                                                            +import { getUserInfo, getOpenId } from '@/api/user';
                                                            +
                                                            +export const useUserStore = defineStore('user', {
                                                            +  state: () => ({
                                                            +    token: '',
                                                            +    userInfo: null,
                                                            +    openId: '',
                                                            +    unionId: '',
                                                            +    sessionKey: '',
                                                            +  }),
                                                            +  getters: {
                                                            +    isLogin() {
                                                            +      return !!this.token;
                                                            +    },
                                                            +    isAdmin() {
                                                            +      const userInfo = this.userInfo;
                                                            +      return !!(
                                                            +        userInfo &&
                                                            +        userInfo.rolePermission &&
                                                            +        userInfo.rolePermission.includes('admin')
                                                            +      );
                                                            +    },
                                                            +  },
                                                            +  persist: {
                                                            +    storage: {
                                                            +      getItem: (key) => uni.getStorageSync(key),
                                                            +      setItem: (key, value) => uni.setStorageSync(key, value),
                                                            +    },
                                                            +  },
                                                            +});
                                                            +
                                                            Last Updated: 9/1/2024, 6:28:54 PM
                                                              + + + diff --git a/uniapp/upload.html b/uniapp/upload.html new file mode 100644 index 0000000..e615fde --- /dev/null +++ b/uniapp/upload.html @@ -0,0 +1,42 @@ + + + + + + 上传图片 | 点滴记录 + + + + + + + + + + + + diff --git a/uniapp/upx.html b/uniapp/upx.html new file mode 100644 index 0000000..e2fc58e --- /dev/null +++ b/uniapp/upx.html @@ -0,0 +1,43 @@ + + + + + + 响应式单位 | 点滴记录 + + + + + + + + +

                                                              响应式单位

                                                              # 响应式单位

                                                              # 尺寸单位

                                                              尺寸单位 (opens new window)

                                                              # 单位之间的转换

                                                              • uniapp px rpx 互相转换
                                                              // 100rpx to px
                                                              +var px = uni.upx2px(100)
                                                              +
                                                              +// 200px to rpx
                                                              +var rpx = 200 / (uni.upx2px(100) / 100);
                                                              +
                                                              Last Updated: 6/25/2022, 5:25:39 PM
                                                                + + + diff --git a/vite/index.html b/vite/index.html new file mode 100644 index 0000000..4bd2918 --- /dev/null +++ b/vite/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

                                                                vite

                                                                Last Updated: 6/25/2022, 5:25:39 PM
                                                                  + + + diff --git a/vue/index.html b/vue/index.html new file mode 100644 index 0000000..7ab1b48 --- /dev/null +++ b/vue/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

                                                                  vue

                                                                  Last Updated: 6/25/2022, 5:25:39 PM
                                                                    + + + diff --git a/webpack/index.html b/webpack/index.html new file mode 100644 index 0000000..c037840 --- /dev/null +++ b/webpack/index.html @@ -0,0 +1,38 @@ + + + + + + 点滴记录 + + + + + + + + +

                                                                    webpack

                                                                    Last Updated: 6/25/2022, 5:25:39 PM
                                                                      + + + diff --git a/wechat-public/faq.html b/wechat-public/faq.html new file mode 100644 index 0000000..cc71b33 --- /dev/null +++ b/wechat-public/faq.html @@ -0,0 +1,40 @@ + + + + + + 常见问题 | 点滴记录 + + + + + + + + +

                                                                      常见问题

                                                                      # 常见问题

                                                                      • 获取微信 accessToken 报错,错误如下:

                                                                      {"errcode":40164,"errmsg":"invalid ip 118.250.108.249 ipv6 ::ffff:118.250.108.249, not in whitelist rid: 626122d8-46f3010d-639daae4"}

                                                                      错误信息很明显,IP白名单问题,大概步骤:

                                                                      登录公众平台 > 开发 > 基本配置 > IP白名单 > 查看 > 修改 >将ip地址添加进去,多个通过 "," 逗号分隔 > 点击"确认修改"

                                                                      Last Updated: 6/25/2022, 5:25:39 PM
                                                                        + + + diff --git a/wechat-public/index.html b/wechat-public/index.html new file mode 100644 index 0000000..15734ea --- /dev/null +++ b/wechat-public/index.html @@ -0,0 +1,40 @@ + + + + + + 配置环境 | 点滴记录 + + + + + + + + +

                                                                        配置环境

                                                                        # 配置环境

                                                                        Last Updated: 6/25/2022, 5:25:39 PM
                                                                          + + +