setCookie
设置 cookie
ts
/**
* 设置 cookie
* @returns
*/
declare function setCookie(key: string, data: any): string | undefined
1
2
3
4
5
2
3
4
5
使用示例
ts
import { setCookie } from '@plus-pro-components/utils'
setCookie('username', 'name')
1
2
3
2
3
getCookie
获取 cookie
ts
/**
* 获取 cookie
* @returns
*/
declare function getCookie(key: string): string | undefined
1
2
3
4
5
2
3
4
5
使用示例
ts
import { getCookie } from '@plus-pro-components/utils'
getCookie('username') // name
1
2
3
2
3
removeCookie
移除 cookie
ts
/**
* 移除 cookie
*/
declare function removeCookie(key: string): void
1
2
3
4
2
3
4
使用示例
ts
import { removeCookie } from '@plus-pro-components/utils'
removeCookie('username')
1
2
3
2
3