<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        輕量級JS Cookie插件js-cookie的使用方法

        來源:懂視網 責編:小采 時間:2020-11-27 22:17:19
        文檔

        輕量級JS Cookie插件js-cookie的使用方法

        輕量級JS Cookie插件js-cookie的使用方法:Cookie是網站設計者放置在客戶端的小文本文件,一般后臺語言使用的比較多,可以實現用戶個性化的一些需求。js-cookie插件是一個JS操作cookie的插件,源文件只有3.34 KB,非常輕量級。js-cookie也支持npm和Bower安裝和管理。下面看看js-cookie的具體
        推薦度:
        導讀輕量級JS Cookie插件js-cookie的使用方法:Cookie是網站設計者放置在客戶端的小文本文件,一般后臺語言使用的比較多,可以實現用戶個性化的一些需求。js-cookie插件是一個JS操作cookie的插件,源文件只有3.34 KB,非常輕量級。js-cookie也支持npm和Bower安裝和管理。下面看看js-cookie的具體

        Read all visible cookies:

        Cookies.get(); // => { name: 'value' }

        Delete cookie:

        Cookies.remove('name');

        Delete a cookie valid to the path of the current page:

        Cookies.set('name', 'value', { path: '' });
        Cookies.remove('name'); // fail!
        Cookies.remove('name', { path: '' }); // removed!

        IMPORTANT! When deleting a cookie, you must pass the exact same path and domain attributes that were used to set the cookie, unless you're relying on the default attributes.

        Note: Removing a nonexistent cookie does not raise any exception nor return any value.

        Namespace conflicts

        If there is any danger of a conflict with the namespace Cookies, the noConflict method will allow you to define a new namespace and preserve the original one. This is especially useful when running the script on third party sites e.g. as part of a widget or SDK.

        // Assign the js-cookie api to a different variable and restore the original "window.Cookies"

        var Cookies2 = Cookies.noConflict();
        Cookies2.set('name', 'value');

        Note: The .noConflict method is not necessary when using AMD or CommonJS, thus it is not exposed in those environments.

        JSON

        js-cookie provides unobtrusive JSON storage for cookies.

        When creating a cookie you can pass an Array or Object Literal instead of a string in the value. If you do so, js-cookie will store the string representation of the object according to JSON.stringify:

        Cookies.set('name', { foo: 'bar' });

        When reading a cookie with the default Cookies.get api, you receive the string representation stored in the cookie:

        Cookies.get('name'); // => '{"foo":"bar"}'
        Cookies.get(); // => { name: '{"foo":"bar"}' }

        When reading a cookie with the Cookies.getJSON api, you receive the parsed representation of the string stored in the cookie according to JSON.parse:

        Cookies.getJSON('name'); // => { foo: 'bar' }
        Cookies.getJSON(); // => { name: { foo: 'bar' } }

        Note: To support IE6-7 (and IE 8 compatibility mode) you need to include the JSON-js polyfill: https://github.com/douglascrockford/JSON-js

        更多的可以參考官方說明:

        https://github.com/js-cookie/js-cookie

        https://www.npmjs.com/package/js-cookie

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        輕量級JS Cookie插件js-cookie的使用方法

        輕量級JS Cookie插件js-cookie的使用方法:Cookie是網站設計者放置在客戶端的小文本文件,一般后臺語言使用的比較多,可以實現用戶個性化的一些需求。js-cookie插件是一個JS操作cookie的插件,源文件只有3.34 KB,非常輕量級。js-cookie也支持npm和Bower安裝和管理。下面看看js-cookie的具體
        推薦度:
        標簽: cookie js cookies
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 免费人成网站在线高清| 免费国产黄网站在线观看| 热久久精品免费视频| 亚洲一区二区三区高清视频| 久久99热精品免费观看动漫| 国产v亚洲v天堂无码网站| 中国国语毛片免费观看视频| 久久亚洲色一区二区三区| 久久精品成人免费国产片小草| 亚洲中文久久精品无码| 拍拍拍无挡免费视频网站| 亚洲春色在线视频| 免费A级毛片无码A∨| 国产99在线|亚洲| 国产高清在线免费视频| 无码毛片一区二区三区视频免费播放 | 亚洲一本到无码av中文字幕| 91成人免费观看网站| 久久久久亚洲AV无码专区体验 | 欧洲精品成人免费视频在线观看 | 亚洲区视频在线观看| 国产精品视频免费一区二区 | 亚洲宅男永久在线| 在线天堂免费观看.WWW| 亚洲AV无码一区二区三区鸳鸯影院| 亚洲av片一区二区三区| 亚欧日韩毛片在线看免费网站| 2020国产精品亚洲综合网| 亚洲男人的天堂一区二区| 国产精品区免费视频| 亚洲精品国产摄像头| 亚洲成AV人片天堂网无码| 成人免费毛片观看| 99视频免费在线观看| 亚洲一区在线视频观看| 亚洲综合色视频在线观看| 亚洲三级在线免费观看| 免费人成大片在线观看播放| 亚洲精品在线视频观看| 亚洲国产精品尤物YW在线观看| 久久久免费精品re6|