{"id":7621,"date":"2018-06-04T01:25:34","date_gmt":"2018-06-03T17:25:34","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7621"},"modified":"2021-03-09T15:26:36","modified_gmt":"2021-03-09T07:26:36","slug":"js-localforage-localstorage-indexdb","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2018\/06\/js-localforage-localstorage-indexdb\/","title":{"rendered":"\u7a81\u7834\u672c\u5730\u79bb\u7ebf\u5b58\u50a85M\u9650\u5236\u7684JS\u5e93localforage\u7b80\u4ecb"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7621\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=7621<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u4f46\u9700\u5f97\u5230\u539f\u4f5c\u8005\u4e66\u9762\u8bb8\u53ef\uff0c\u540c\u65f6\u4fdd\u7559\u539f\u4f5c\u8005\u548c\u51fa\u5904\uff0c\u6458\u8981\u5f15\u6d41\u5219\u968f\u610f\u3002<\/p>\n<p><strong>\u66f4\u65b0\u4e8e2021-03-09<\/strong><\/p>\n<p>\u5982\u679c\u9879\u76ee\u65e0\u9700\u517c\u5bb9IE\u6d4f\u89c8\u5668\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u4f7f\u7528yux-storage\uff0c\u4e00\u6837\u7684API\uff0c\u4f46\u662f\u4ee3\u7801\u91cf\u5c11\u4e86\u4e00\u4e2a\u6570\u91cf\u7ea7\uff0c\u5c31100\u884c\u5de6\u53f3\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/yued-fe\/yux-storage\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/yued-fe\/yux-storage<\/a><\/p>\n<h3>\u4e00\u3001localforage\u9879\u76ee\u7b80\u4ecb<\/h3>\n<p><code>localforage<\/code>\u9879\u76ee\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/localForage\/localForage\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/localForage\/localForage<\/a><\/p>\n<p>\u622a\u6b62\u4eca\u65e5\uff082018-06-03\uff09\uff0c\u5df2\u7ecf\u670912000+\u4e2a\u661f\u661f\uff0c\u4e07\u7ea7\u522b\u7684\u9879\u76ee\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201806\/2018-06-03_235710.png\" width=\"385\" height=\"54\" alt=\"localforage\u9879\u76eestar\u6570\u636e\" class=\"alignnone\" \/><\/p>\n<p>JS\u6587\u4ef6\u4e0b\u8f7d\uff08\u53f3\u952e\uff0c\u53e6\u5b58\u4e3a\uff09\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/201806\/localforage.min.js\" rel=\"noopener\" target=\"_blank\">localforage.min.js<\/a><\/p>\n<p><code>localforage<\/code>\u7528\u6765\u672c\u5730\u5b58\u50a8\u6570\u636e\u7684\u3002<\/p>\n<p>\u8bf4\u5230\u672c\u5730\u5b58\u50a8\u6570\u636e\uff0c\u6211\u4eec\u9996\u5148\u60f3\u5230\u7684\u662f<code>localStorage<\/code>\uff0c\u5e94\u8be5\u5f88\u591a\u5c0f\u4f19\u4f34\u90fd\u7528\u8fc7\uff0c\u4f7f\u7528\u5f88\u7b80\u5355\u3002\u7136\u800c\uff0c<code>localStorage<\/code>\u5374\u6709\u4e0b\u9762\u4e00\u4e9b\u7f3a\u70b9\uff1a<\/p>\n<ol>\n<li>\u5b58\u50a8\u5bb9\u91cf\u9650\u5236\uff0c\u5927\u90e8\u5206\u6d4f\u89c8\u5668\u5e94\u8be5\u6700\u591a5M\u3002\u6211\u5c31\u9047\u5230\u8fc7localStorage\u5b58\u50a8\u5b57\u7b26\u7136\u540e\u5c3a\u5bf8\u7206\u6389\u7684\u60c5\u51b5\u3002<\/li>\n<li>\u4ec5\u652f\u6301\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u662f\u5b58\u5bf9\u8c61\u8fd8\u9700\u8981\u5c06\u4f7f\u7528JSON.stringify\u548cJSON.parse\u65b9\u6cd5\u4e92\u76f8\u8f6c\u6362\uff0c\u6709\u4e9b\u5570\u55e6\u3002 <\/li>\n<li>\u8bfb\u53d6\u90fd\u662f\u540c\u6b65\u7684\u3002\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u8fd8\u633a\u597d\u4f7f\u7684\u3002\u4f46\uff0c\u5982\u679c\u5b58\u50a8\u6570\u636e\u6bd4\u8f83\u5927\uff0c\u4f8b\u5982\u4e00\u5f20\u91cd\u8981\u56fe\u7247base64\u683c\u5f0f\u5b58\u50a8\u4e86\uff0c\u518d\u8bfb\u53ef\u80fd\u4f1a\u6709\u53ef\u611f\u77e5\u7684\u5ef6\u8fdf\u65f6\u95f4\u3002<\/li>\n<\/ol>\n<p><code>localforage<\/code>\u7684\u4f5c\u7528\u5c31\u662f\u7528\u6765\u89c4\u907f\u4e0a\u9762<code>localStorage<\/code>\u7684\u7f3a\u70b9\uff0c\u540c\u65f6\u4fdd\u7559<code>localStorage<\/code>\u7684\u4f18\u70b9\u800c\u8bbe\u8ba1\u7684\u3002\u4ece\u547d\u540d\u4e0a\u5c31\u53ef\u4ee5\u770b\u51fa\u4e24\u8005\u5173\u7cfb\u4e0d\u6d45\u3002<\/p>\n<p><code>localStorage<\/code>\u7684\u4f18\u70b9\u662fAPI\u975e\u5e38\u7b80\u5355\uff0c\u4f7f\u7528\u5f88\u65b9\u4fbf\u3002\u4e8e\u662f\uff0c<code>localforage<\/code>\u548c<code>localStorage<\/code>\u4e00\u6a21\u4e00\u6837\u3002<\/p>\n<p>\u81f3\u4e8e<code>localStorage<\/code>\u7684\u4e0d\u8db3\uff0c<code>localforage<\/code>\u548c\u4f7f\u7528\u4e86\u5176\u4ed6HTML5 API\u8fdb\u884c\u89c4\u907f\uff0c\u4ec0\u4e48API\u5462\uff1f\u662f<code>IndexedDB<\/code>\u548c<code>WebSQL<\/code>\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c<code>localforage<\/code>\u7684\u903b\u8f91\u662f\u8fd9\u6837\u7684\uff1a\u4f18\u5148\u4f7f\u7528<code>IndexedDB<\/code>\u5b58\u50a8\u6570\u636e\uff0c\u5982\u679c\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\uff0c\u4f7f\u7528<code>WebSQL<\/code>\uff0c\u6d4f\u89c8\u5668\u518d\u4e0d\u652f\u6301\uff0c\u4f7f\u7528<code>localStorage<\/code>\u3002<\/p>\n<p>\u7136\u540eAPI\u8fd8\u662f<code>localStorage<\/code>\u7684API\uff0c\u4e5f\u5c31\u662f\u6570\u636e\u589e\u5220\u6539\u67e5\u901a\u8fc7<code>get<\/code>\uff0c<code>set<\/code>\uff0c<code>remove<\/code>\uff0c<code>clear<\/code>\u548c<code>length<\/code>\u7b49API\u3002<\/p>\n<h3>\u4e8c\u3001localforage\u4f7f\u7528\u6848\u4f8b\u4e00\u5219<\/h3>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201806\/localforage-store-img.html\" rel=\"noopener\" target=\"_blank\">localforage\u5b58\u50a8blob\u683c\u5f0f\u7684\u672c\u5730\u4e0a\u4f20\u56fe\u7247demo<\/a><\/p>\n<p>\u7b2c\u4e00\u6b21\u8fdb\u5165\u8fd9\u4e2ademo\u9875\u9762\uff0c\u53ea\u6709\u4e00\u4e2a\u4e0a\u4f20\u56fe\u7247\u6309\u94ae\u3002<\/p>\n<p>\u9009\u62e9\u4e0a\u4f20\u56fe\u7247\u6309\u94ae\uff0c\u5219\u4f1a\u4ee5blob\u7684\u5f62\u5f0f\u76f4\u63a5\u628a\u9009\u62e9\u7684\u56fe\u7247\u5728\u7f51\u9875\u4e2d\u663e\u793a\u5904\u7406\uff0c\u4f8b\u5982\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201806\/2018-06-04_005702.png\" width=\"343\" height=\"505\" alt=\"\u4e0a\u4f20\u56fe\u7247\u793a\u610f\" class=\"alignnone\" \/><\/p>\n<p>\u6b64\u65f6\uff0c\u4f60\u518d\u5237\u65b0\u9875\u9762\uff0c\u5219\u663e\u793a\u7684\u8fd8\u662f\u8fd9\u5f20\u56fe\u7247\uff0c\u56e0\u4e3a\u4f7f\u7528<code>localforage<\/code>\u628a\u8fd9\u5f20\u56fe\u7247\u4ee5blob\u6570\u636e\u5f62\u5f0f\u5b58\u50a8\u5728\u4e86\u672c\u5730\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201806\/2018-06-04_005900.png\" width=\"407\" height=\"508\" alt=\"\u5237\u65b0\u540e\u7684\u6548\u679c\u622a\u56fe\" class=\"alignnone\" \/><\/p>\n<p>\u76f8\u5173HTML\u4ee3\u7801\u4e3a\uff1a<\/p>\n<pre>&lt;label for=\"fileImg\"&gt;\u4e0a\u4f20\u56fe\u7247&lt;\/label&gt;\r\n&lt;input type=\"file\" id=\"fileImg\" accept=\"image\/*\" hidden&gt; \r\n&lt;p id=\"result\"&gt;&lt;\/p&gt;<\/pre>\n<p>\u7136\u540eJS\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;script src=\".\/localforage.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\nvar eleResult = document.getElementById('result');\r\n<span style=\"color:green;\">\/\/ \u56fe\u7247\u8d44\u6e90<\/span>\r\nvar eleImg = document.createElement('img');\r\n<span style=\"color:green;\">\/\/ \u83b7\u53d6\u672c\u5730\u5b58\u50a8\u6570\u636e<\/span>\r\nlocalforage.getItem('zxxImg', function (err, value) {\r\n    if (err == null &amp;&amp; value) {\r\n        eleImg.src = value;\r\n        eleResult.appendChild(eleImg);\r\n    }\r\n});\r\n<span style=\"color:green;\">\/\/ \u9009\u62e9\u7684\u672c\u5730\u6587\u4ef6\u4ee5Blob\u5f62\u5f0f\u5448\u73b0<\/span>\r\nvar reader = new FileReader();\r\nreader.onload = function(event) {\r\n    if (!eleImg.src) {\r\n        eleResult.appendChild(eleImg);\r\n    }\r\n    var blob = URL.createObjectURL(new Blob([event.target.result]));\r\n    eleImg.src = blob;\r\n    <span style=\"color:green;\">\/\/ blob\u672c\u5730\u5b58\u50a8<\/span>\r\n    localforage.setItem('zxxImg', blob);\r\n};\r\n<span style=\"color:green;\">\/\/ \u9009\u62e9\u7684\u6587\u4ef6\u5bf9\u8c61<\/span>\r\nvar file = null;\r\ndocument.getElementById('fileImg').addEventListener('change', function (event) {\r\n    file = event.target.files[0];\r\n    <span style=\"color:green;\">\/\/ \u9009\u62e9\u7684\u6587\u4ef6\u662f\u56fe\u7247<\/span>\r\n    if (file.type.indexOf(\"image\") == 0) {\r\n        reader.readAsArrayBuffer(file);    \r\n    }\r\n});\r\n&lt;\/script&gt;<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u867d\u7136localforage\u7684API\u540d\u79f0\u548clocalStorage\u4e00\u6837\uff0c\u4f46\u662f\uff0c\u5728\u540c\u6b65\u8fd8\u662f\u5f02\u6b65\u4e0a\u5374\u4e0d\u540c\uff0clocalforage\u662f\u5f02\u6b65\u6267\u884c\u7684\uff0c\u7528\u6cd5\u793a\u610f\u5982\u4e0b\u3002<\/p>\n<pre>localforage.getItem('key', function (err, value) {\r\n    <span style=\"color:green;\">\/\/ \u5982\u679cerr\u4e0d\u662fnull\uff0c\u5219\u51fa\u9519\u3002\u5426\u5219value\u5c31\u662f\u6211\u4eec\u60f3\u8981\u7684\u503c<\/span>\r\n});<\/pre>\n<p><strong>\u66f4\u65b0\u4e8e2019-08-04<\/strong><br \/>\n\u8865\u5145\u4e00\u4e2a\u81ea\u5df1\u5e38\u7528\u7684\u5b58\u53d6\u7ec4\u5408\u4ee3\u7801\uff1a<\/p>\n<pre><span style=\"color:green;\">\/\/ \u4e3a\u4e86\u5927\u5bb6\u4efb\u610f\u573a\u666f\u53ef\u4ee5\u7c98\u8d34\u4f7f\u7528\uff0c\u5168\u90e8\u6539\u6210\u5b57\u9762\u91cf\u98ce\u683c<\/span>\r\nvar storage = {};\r\nvar storkey = 'SOME_KEY';\r\n<span style=\"color:green;\">\/**\r\n * \u83b7\u53d6\u6b64\u65f6\u7684\u672c\u5730\u5b58\u50a8\r\n *\/<\/span>\r\nvar getStorage = function (callback) {\r\n    callback = callback || function () {};\r\n    <span style=\"color:green;\">\/\/ \u83b7\u53d6<\/span>\r\n    localforage.getItem(storkey, function (err, value) {\r\n        if (err == null && value) {\r\n            storage = value;\r\n        }\r\n        callback(err);\r\n    });\r\n};\r\n<span style=\"color:green;\">\/**\r\n * \u8bbe\u7f6e\u65b0\u7684\u672c\u5730\u5b58\u50a8\r\n *\/<\/span>\r\nvar setStorage = function (callback) {\r\n    callback = callback || function () {};\r\n    <span style=\"color:green;\">\/\/ \u5b58\u50a8<\/span>\r\n    localforage.setItem(storkey, storage, function (err) {\r\n        err && console.error(err);\r\n        callback();\r\n    });\r\n};<\/pre>\n<p>\u901a\u5e38\u4f7f\u7528\u5148getStorage\u7136\u540e\u518d\u521d\u59cb\u5316\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>getStorage(function () {\r\n    init();\r\n});<\/pre>\n<h3>\u4e09\u3001localforage\u548cindexDB\u7684\u533a\u522b<\/h3>\n<p><code>indexDB<\/code>\u4e3a\u672c\u5730\u6570\u636e\u5e93\u5b58\u50a8\uff0c\u5176\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u518d\u590d\u6742\u7684\u7ed3\u6784\u5b58\u50a8\u90fd\u4e0d\u5728\u8bdd\u4e0b\u3002<code>localStorage<\/code>\u53ea\u662f\u4f7f\u7528\u4e86\u5176\u529f\u80fd\u4e2d\u7684\u4e00\u90e8\u5206\uff0c\u5f88\u591a\u529f\u80fd\u53d7\u9650\uff0c\u4f8b\u5982\uff0c<code>localStorage<\/code>\u4e00\u6b21\u53ea\u80fd\u5b58\u4e00\u4e2a\u5b57\u6bb5\u3002<\/p>\n<p>\u6211\u4e4b\u524d\u6709\u4e13\u95e8\u5199\u8fc7\u6587\u7ae0\u4ecb\u7ecdHTML5 <code>indexedDB<\/code>\uff0c\u6587\u7ae0\u540d\u4e3a\uff1a\u201c<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/2017\/07\/html5-indexeddb-js-example\/\">HTML5 indexedDB\u524d\u7aef\u672c\u5730\u5b58\u50a8\u6570\u636e\u5e93\u5b9e\u4f8b\u6559\u7a0b<\/a>\u201d\u3002<\/p>\n<p><code>indexDB<\/code>\u51e0\u4e4e\u7a7a\u95f4\u65e0\u9650\uff0c\u6027\u80fd\u4e5f\u4e0d\u9519\uff0c\u5404\u79cd\u6570\u636e\u7ed3\u6784\u90fd\u652f\u6301\uff0c\u4e3a\u4f55\u603b\u611f\u89c9\u5728\u4e1a\u5185\u4e0d\u6e29\u4e0d\u706b\u5462\uff1f<\/p>\n<p>\u6211\u89c9\u5f97\u5f88\u91cd\u8981\u7684\u539f\u56e0\u4e4b\u4e00\u5c31\u662f\u4e0a\u624b\u6210\u672c\uff0c\u5305\u62ec2\u65b9\u9762\uff1a<\/p>\n<ol>\n<li>\u524d\u7aef\u9700\u8981\u4e86\u89e3\u6570\u636e\u5e93\u7684\u4e00\u4e9b\u57fa\u672c\u6982\u5ff5\uff0c\u4f8b\u5982\u8868\uff0c\u6e38\u6807\uff0c\u4e8b\u52a1\uff0c\u9501\u7b49\u3002\u800c\u4e1a\u754c\u666e\u904d\u7684\u524d\u7aef\u90fd\u662f\u4e0e\u9875\u9762\u6253\u4ea4\u9053\u7684\uff0c\u6570\u636e\u5e93\u64cd\u4f5c\u5c5e\u4e8e\u540e\u7aef\u7684\u540e\u7aef\u4e86\uff0c\u79bb\u7684\u6709\u4e9b\u8fdc\uff0c\u4e8e\u662f\uff0c\u5f88\u591a\u524d\u7aef\u90fd\u4e0d\u4e86\u89e3\uff0c\u9700\u8981\u4ece\u96f6\u5f00\u59cb\u7684\u6570\u636e\u5e93\u5b66\u4e60\u3002<\/li>\n<li>indexedDB\u7684API\u53c8\u591a\u53c8\u957f\u53c8\u7eb7\u6742\uff0c\u5b66\u4e60\u6210\u672c\u9ad8\uff0c\u5bb9\u6613\u8bb0\u4e0d\u4f4f\uff0c\u7f51\u4e0a\u597d\u7684\u8d44\u6e90\u5c11\u3002<\/li>\n<\/ol>\n<p><code>localforage<\/code>\u7684\u51fa\u73b0\u53ef\u8c13\u66f2\u7ebf\u6551\u56fd\uff0c\u901a\u5e38\u6211\u4eec\u7684\u6570\u636e\u5b58\u50a8\u5e76\u4e0d\u9700\u8981\u7279\u522b\u590d\u6742\uff0c\u53ea\u8981\u4e0d\u662f\u5b8c\u5b8c\u5168\u5168\u7684\u79bb\u7ebf\u5f00\u53d1\uff0c<code>localforage<\/code>\u8db3\u77e3\u3002\u65e2\u4e0d\u6d6a\u8d39<code>indexDB<\/code>\u7684\u597d\uff0c\u53c8\u907f\u5f00\u4e86<code>indexDB<\/code>\u9ad8\u4e0a\u624b\u6210\u672c\u7684\u5751\u3002\u4ece\u8fd9\u4e2a\u89d2\u5ea6\u770b\uff0c<code>indexDB<\/code>\u5e94\u8be5\u8981\u8c22\u8c22<code>localforage<\/code>\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u5b58\u50a8\u7684\u6570\u636e\u662f\u8d1f\u8d23\u7684\u591a\u884c\u591a\u5217\u8868\u7ed3\u6784\uff0c\u6211\u5efa\u8bae\u8fd8\u662f\u8001\u8001\u5b9e\u5b9e\u82b1\u70b9\u529f\u592b\u5b66\u4e60\u5b66\u4e60<code>indexDB<\/code>\u7684\u4f7f\u7528\u3002<\/p>\n<h3>\u56db\u3001\u7ed3\u675f\u8bed<\/h3>\n<p><code>indexDB<\/code> IE10+\u6d4f\u89c8\u5668\u652f\u6301\u3002\u56e0\u6b64\uff0c\u5982\u679c\u60f3\u8981\u4f7f\u7528<code>localforage<\/code>\u5b58\u50a8\u4efb\u610f\u683c\u5f0f\u6570\u636e\uff0c\u9700\u8981\u6ce8\u610f\u4e0b\u6d4f\u89c8\u5668\u7684\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u4f8b\u5982\uff0c\u672c\u5730\u56fe\u7247\u5b58\u50a8Blob\u6570\u636e\uff0cIE9\u80af\u5b9a\u662f\u4e0d\u652f\u6301\u7684\u3002\u8fd9\u4e9b\u6d4f\u89c8\u5668\u6015\u662f\u53ea\u80fd\u5b58\u5b57\u7b26\u4e32\u4e86\u3002<\/p>\n<p>\u4e00\u4e2a\u4e1c\u897f\u662f\u5426\u6709\u751f\u547d\u529b\uff0c\u770b\u7684\u4e0d\u662f\u5176\u662f\u5426\u5f3a\u5927\uff0c\u800c\u662f\u662f\u5426\u8db3\u591f\u7b80\u5355\u3002<\/p>\n<p>\u5c31\u9171\u7d2b\uff0c\u611f\u8c22\u9605\u8bfb\uff01<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201611\/14.png\" align=\"absmiddle\"><\/p>\n<p><span class=\"s\">\/\/zxx: \u4eca\u5929\u9a91\u58eb\u3001\u52c7\u58eb\u7b2c\u4e8c\u573a\uff0c\u9a91\u58eb\u51f6\u591a\u5409\u5c11\uff0c\u6211\u89c9\u5f97\u7b2c\u56db\u8282\u5f88\u53ef\u80fd\u4f1a\u6709\u5783\u573e\u65f6\u95f4\u3002\u7b2c\u4e00\u573a\u7740\u5b9e\u53ef\u60dc\u4e86\u3002<\/span><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7621\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=7621<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u5230\u672c\u5730\u5b58\u50a8\u6570\u636e\uff0c\u6211\u4eec\u9996\u5148\u60f3\u5230\u7684\u662flocalStorage\uff0c\u5e94\u8be5\u5f88\u591a\u5c0f\u4f19\u4f34\u90fd\u7528\u8fc7\uff0c\u4f7f\u7528\u5f88\u7b80\u5355\u3002\u7136\u800c\uff0clocalStorage\u5374\u6709\u4e0d\u5c11\u786e\u5b9a\uff0c\u5982\u5b58\u50a8\u5bb9\u91cf\u9650\u5236\uff0c\u53ea\u652f\u6301\u5b57\u7b26\u4e32\u7b49\u3002localforage\u7684\u4f5c\u7528\u5c31\u662f\u7528\u6765\u89c4\u907f\u4e0a\u9762localStorage\u7684\u7f3a\u70b9\uff0c\u540c\u65f6\u4fdd\u7559localStorage\u7684\u4f18\u70b9\u800c\u8bbe\u8ba1\u7684\u3002\u5177\u4f53\u662f\u600e\u4e48\u89c4\u907f\u7684\u5462\uff1f\u6700\u7ec8\u4f7f\u7528\u6548\u679c\u53c8\u662f\u600e\u6837\uff1f<\/p>\n<p>\u5373\u5c06\u4e3a\u4f60\u63ed\u6653\u2026\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[180],"tags":[872,1264,1265,641,488,749],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/7621"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=7621"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/7621\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=7621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=7621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=7621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}