<p align="center">
<img src="https://cloud.githubusercontent.com/assets/835857/14581711/ba623018-0436-11e6-8fce-d2ccd4d379c9.gif">
</p>
# JavaScript Cookie [![Build Status](https://travis-ci.com/js-cookie/js-cookie.svg?branch=master)](https://travis-ci.com/js-cookie/js-cookie) [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=b3VDaHAxVDg0NDdCRmtUOWg0SlQzK2NsRVhWTjlDQS9qdGJoak1GMzJiVT0tLVhwZHNvdGRoY284YVRrRnI3eU1JTnc9PQ==--5e88ffb3ca116001d7ef2cfb97a4128ac31174c2)](https://www.browserstack.com/automate/public-build/b3VDaHAxVDg0NDdCRmtUOWg0SlQzK2NsRVhWTjlDQS9qdGJoak1GMzJiVT0tLVhwZHNvdGRoY284YVRrRnI3eU1JTnc9PQ==--5e88ffb3ca116001d7ef2cfb97a4128ac31174c2) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Code Climate](https://codeclimate.com/github/js-cookie/js-cookie.svg)](https://codeclimate.com/github/js-cookie/js-cookie) [![npm](https://img.shields.io/github/package-json/v/js-cookie/js-cookie)](https://www.npmjs.com/package/js-cookie) [![size](https://img.shields.io/bundlephobia/minzip/js-cookie/3)](https://www.npmjs.com/package/js-cookie) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/js-cookie/badge?style=rounded)](https://www.jsdelivr.com/package/npm/js-cookie)
A simple, lightweight JavaScript API for handling cookies
- Works in [all](https://www.browserstack.com/automate/public-build/b3VDaHAxVDg0NDdCRmtUOWg0SlQzK2NsRVhWTjlDQS9qdGJoak1GMzJiVT0tLVhwZHNvdGRoY284YVRrRnI3eU1JTnc9PQ==--5e88ffb3ca116001d7ef2cfb97a4128ac31174c2) browsers
- Accepts [any](#encoding) character
- [Heavily](test) tested
- No dependency
- Supports ES modules
- Supports AMD/CommonJS
- [RFC 6265](https://tools.ietf.org/html/rfc6265) compliant
- Useful [Wiki](https://github.com/js-cookie/js-cookie/wiki)
- Enable [custom encoding/decoding](#converters)
- **< 800 bytes** gzipped!
**ðð If you're viewing this at https://github.com/js-cookie/js-cookie, you're reading the documentation for the master branch.
[View documentation for the latest release.](https://github.com/js-cookie/js-cookie/tree/latest#readme) ðð**
## Installation
### NPM
JavaScript Cookie supports [npm](https://www.npmjs.com/package/js-cookie) under the name `js-cookie`.
```
$ npm i js-cookie
```
The npm package has a `module` field pointing to an ES module variant of the library, mainly to provide support for ES module aware bundlers, whereas its `browser` field points to an UMD module for full backward compatibility.
### Direct download
Starting with version 3 [releases](https://github.com/js-cookie/js-cookie/releases) are distributed with two variants of this library, an ES module as well as an UMD module.
Note the different extensions: `.mjs` denotes the ES module, whereas `.js` is the UMD one.
Example for how to load the ES module in a browser:
```html
<script type="module" src="/path/to/js.cookie.mjs"></script>
<script type="module">
import Cookies from '/path/to/js.cookie.mjs'
Cookies.set('foo', 'bar')
</script>
```
_Not all browsers support ES modules natively yet_. For this reason the npm package/release provides both the ES and UMD module variant and you may want to include the ES module along with the UMD fallback to account for this:
```html
<script type="module" src="/path/to/js.cookie.mjs"></script>
<script nomodule defer src="/path/to/js.cookie.js"></script>
```
Here we're loading the nomodule script in a deferred fashion, because ES modules are deferred by default. This may not be strictly necessary depending on how you're using the library.
### CDN
Alternatively, include it via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/js-cookie).
## ES Module
Example for how to import the ES module from another module:
```javascript
import Cookies from 'js-cookie'
Cookies.set('foo', 'bar')
```
## Basic Usage
Create a cookie, valid across the entire site:
```javascript
Cookies.set('name', 'value')
```
Create a cookie that expires 7 days from now, valid across the entire site:
```javascript
Cookies.set('name', 'value', { expires: 7 })
```
Create an expiring cookie, valid to the path of the current page:
```javascript
Cookies.set('name', 'value', { expires: 7, path: '' })
```
Read cookie:
```javascript
Cookies.get('name') // => 'value'
Cookies.get('nothing') // => undefined
```
Read all visible cookies:
```javascript
Cookies.get() // => { name: 'value' }
```
_Note: It is not possible to read a particular cookie by passing one of the cookie attributes (which may or may not
have been used when writing the cookie in question):_
```javascript
Cookies.get('foo', { domain: 'sub.example.com' }) // `domain` won't have any effect...!
```
The cookie with the name `foo` will only be available on `.get()` if it's visible from where the
code is called; the domain and/or path attribute will not have an effect when reading.
Delete cookie:
```javascript
Cookies.remove('name')
```
Delete a cookie valid to the path of the current page:
```javascript
Cookies.set('name', 'value', { path: '' })
Cookies.remove('name') // fail!
Cookies.remove('name', { path: '' }) // removed!
```
_IMPORTANT! When deleting a cookie and you're not relying on the [default attributes](#cookie-attributes), you must pass the exact same path and domain attributes that were used to set the cookie:_
```javascript
Cookies.remove('name', { path: '', domain: '.yourdomain.com' })
```
_Note: Removing a nonexistent cookie neither raises any exception nor returns 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.
```javascript
// 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._
## Encoding
This project is [RFC 6265](http://tools.ietf.org/html/rfc6265#section-4.1.1) compliant. All special characters that are not allowed in the cookie-name or cookie-value are encoded with each one's UTF-8 Hex equivalent using [percent-encoding](http://en.wikipedia.org/wiki/Percent-encoding).
The only character in cookie-name or cookie-value that is allowed and still encoded is the percent `%` character, it is escaped in order to interpret percent input as literal.
Please note that the default encoding/decoding strategy is meant to be interoperable [only between cookies that are read/written by js-cookie](https://github.com/js-cookie/js-cookie/pull/200#discussion_r63270778). To override the default encoding/decoding strategy you need to use a [converter](#converters).
_Note: According to [RFC 6265](https://tools.ietf.org/html/rfc6265#section-6.1), your cookies may get deleted if they are too big or there are too many cookies in the same domain, [more details here](https://github.com/js-cookie/js-cookie/wiki/Frequently-Asked-Questions#why-are-my-cookies-being-deleted)._
## Cookie Attributes
Cookie attribute defaults can be set globally by creating an instance of the api via `withAttributes()`, or individually for each call to `Cookies.set(...)` by passing a plain object as the last argument. Per-call attributes override the default attributes.
### expires
Define when the cookie will be removed. Value must be a [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) which will be interpreted as days from time of creation or a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. If omitted, the cookie becomes a session cookie.
To create a cookie that expires in less than a day, you can check the [FAQ on the Wiki](https://gi
没有合适的资源?快使用搜索试试~ 我知道了~
一个基于Springboot+Vue的前后端分离记账系统Count.zip
共176个文件
js:24个
java:21个
vue:19个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 126 浏览量
2024-05-19
11:47:47
上传
评论
收藏 62.83MB ZIP 举报
温馨提示
该项目利用了基于springboot + vue + mysql的开发模式框架实现的课设系统,包括了项目的源码资源、sql文件、相关指引文档等等。 【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【技术】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
一个基于Springboot+Vue的前后端分离记账系统Count.zip (176个子文件)
.babelrc 230B
mvnw.cmd 7KB
compare 246B
compare 246B
app.8e6ef4c2117440991328a445c3665bba.css 241KB
1676235556647.csv 200B
1676275406126.csv 200B
1674076387186.csv 85B
1674211130764.csv 82B
1674211229300.csv 77B
detail 164B
detail 164B
.editorconfig 147B
.gitignore 395B
.gitignore 154B
.gitkeep 0B
index.html 507B
index.html 267B
server-2.3.7.RELEASE.jar 28.9MB
maven-wrapper.jar 57KB
CreateImageCode.java 7KB
HomeService.java 4KB
Home.java 4KB
User.java 4KB
Querydto.java 2KB
swagger.java 1KB
HomeDto.java 1KB
UserService.java 1KB
1674211051131.java 1KB
CorsConfig.java 998B
IHomeMapper.java 793B
IHomeService.java 759B
CmpDto.java 509B
ServerApplication.java 395B
ListResult.java 385B
SumDto.java 365B
Result.java 338B
UserDto.java 332B
IUserMapper.java 235B
ServerApplicationTests.java 208B
IUserService.java 182B
login.jpeg 214KB
login.jpeg 214KB
10001.jpeg 107KB
10001.jpeg 107KB
1.jpeg 34KB
1.jpeg 34KB
10001.jpg 211KB
10001.jpg 211KB
10002.jpg 134KB
10002.jpg 134KB
login.jpg 105KB
login.0c193e3.jpg 105KB
login.jpg 105KB
home.jpg 50KB
home.5364a16.jpg 50KB
home.jpg 50KB
vendor.dbfd36ad2a6ebda66953.js 1.95MB
0.a131bd752f7194d1b106.js 291KB
1.6102944907e9e1b37faf.js 5KB
webpack.prod.conf.js 5KB
js.cookie.js 4KB
webpack.dev.conf.js 3KB
2.28eb6dbef461127c3162.js 3KB
utils.js 3KB
webpack.base.conf.js 2KB
index.js 2KB
js.cookie.min.js 2KB
manifest.b90192d83f9e383626ad.js 1KB
3.951ac1fccf21b768f539.js 1KB
app.c182dfd6ee26f7c2f4ac.js 1KB
check-versions.js 1KB
build.js 1KB
index.js 986B
main.js 731B
vue-loader.conf.js 553B
index.js 258B
.postcssrc.js 246B
dev.env.js 244B
prod.env.js 82B
index.js 45B
package-lock.json 487KB
package.json 2KB
package.json 2KB
package-lock.json 759B
.package-lock.json 403B
launch.json 389B
settings.json 66B
package.json 54B
additional-spring-configuration-metadata.json 0B
LICENSE 1KB
list 933B
list 933B
3.log 489KB
ok.log 32KB
1.log 23KB
log.log 22KB
2.log 18KB
vendor.dbfd36ad2a6ebda66953.js.map 9.69MB
0.a131bd752f7194d1b106.js.map 1.16MB
共 176 条
- 1
- 2
资源评论
枫蜜柚子茶
- 粉丝: 9019
- 资源: 5351
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- fed54987-3a28-4a7a-9c89-52d3ac6bc048.vsidx
- (177367038)QT实现教务管理系统.zip
- (178041422)基于springboot网上书城系统.zip
- (3127654)超级玛丽游戏源码下载
- (175717016)CTGU单总线CPU设计(变长指令周期3级时序)(HUST)(circ文件)
- (133916396)单总线CPU设计(变长指令周期3级时序)(HUST).rar
- Unity In-game Debug Console
- (3292010)Java图书管理系统(源码)
- Oracle期末复习题:选择题详解与数据库管理技术
- (176721246)200行C++代码写一个Qt俄罗斯方块
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功