mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
- 在 global-layout.scss 中引入全局布局样式,统一页面宽度与对齐方式 - 更新多个组件与页面以优化响应式,包括宽度、间距及 flex 布局等调整 - 在 API 请求中增加 loading 状态管理,改善用户体验 - 优化领券中心与商品详情页,提升功能与 UI 一致性
27 lines
642 B
JavaScript
27 lines
642 B
JavaScript
import Cookies from "js-cookie";
|
|
const psl = require("psl");
|
|
|
|
const isClient = typeof window !== "undefined";
|
|
|
|
function withCookieDomain(options = {}) {
|
|
if (!isClient) {
|
|
return options;
|
|
}
|
|
const pPsl = psl.parse(document.domain);
|
|
let domain = pPsl.domain;
|
|
if (/\d+\.\d+\.\d+\.\d+/.test(pPsl.input)) domain = pPsl.input;
|
|
return { domain, ...options };
|
|
}
|
|
|
|
export default {
|
|
setItem: (key, value, options = {}) => {
|
|
Cookies.set(key, value, withCookieDomain(options));
|
|
},
|
|
getItem: key => {
|
|
return Cookies.get(key);
|
|
},
|
|
removeItem: (key, options = {}) => {
|
|
Cookies.remove(key, withCookieDomain(options));
|
|
}
|
|
};
|