<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
        主站蜘蛛池模板: 亚洲国产精品线观看不卡 | 啦啦啦完整版免费视频在线观看| 免费无码又爽又刺激毛片| 亚洲白色白色在线播放| 亚洲免费闲人蜜桃| 亚洲AV无码乱码麻豆精品国产| 免费精品国产日韩热久久| 亚洲影视自拍揄拍愉拍| 好爽又高潮了毛片免费下载| 亚洲AV无码一区二区三区牲色| 国产片免费福利片永久| 一级毛片成人免费看a| 亚洲成av人影院| 1000部拍拍拍18勿入免费视频下载 | 亚洲av成人一区二区三区| 国产成在线观看免费视频| 亚洲欧美日韩中文高清www777| 国产无遮挡色视频免费视频| 无码精品人妻一区二区三区免费 | 一级做α爱过程免费视频| 亚洲精品无码午夜福利中文字幕| 久久免费国产视频| 亚洲中文久久精品无码1 | 无码日韩精品一区二区免费暖暖| 亚洲首页在线观看| 四虎在线播放免费永久视频| 国产美女视频免费观看的网站| 久久综合亚洲色一区二区三区 | 国产成人精品久久亚洲高清不卡 | 中文字幕免费视频精品一| 亚洲午夜精品国产电影在线观看| 在线精品免费视频| 在线观看免费黄网站| 亚洲精品乱码久久久久久下载| 国产麻豆剧传媒精品国产免费| 91国内免费在线视频| 亚洲kkk4444在线观看| 亚洲综合av永久无码精品一区二区| 亚洲精品视频在线观看免费| 国产成人va亚洲电影| 色婷婷亚洲十月十月色天|