hookehuyr

✨ feat: 新增cookie有效性控制

1 <!-- 1 <!--
2 * @Date: 2022-08-30 14:32:11 2 * @Date: 2022-08-30 14:32:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-21 12:17:06 4 + * @LastEditTime: 2024-11-21 13:14:21
5 * @FilePath: /data-table/src/components/AreaPickerField/index.vue 5 * @FilePath: /data-table/src/components/AreaPickerField/index.vue
6 * @Description: 省市区选择控件 6 * @Description: 省市区选择控件
7 --> 7 -->
...@@ -105,10 +105,10 @@ const onActive = (val) => { ...@@ -105,10 +105,10 @@ const onActive = (val) => {
105 temp.street = val.street; 105 temp.street = val.street;
106 obj[props.item.key] = JSON.stringify(temp); // 替换掉旧值 106 obj[props.item.key] = JSON.stringify(temp); // 替换掉旧值
107 } 107 }
108 - Cookies.set($route.query.code, JSON.stringify(obj)); 108 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
109 } else { 109 } else {
110 // 如果Cookie不存在,新增它 110 // 如果Cookie不存在,新增它
111 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 111 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
112 } 112 }
113 }; 113 };
114 </script> 114 </script>
......
...@@ -173,10 +173,10 @@ watch( ...@@ -173,10 +173,10 @@ watch(
173 // 如果Cookie存在,更新它 173 // 如果Cookie存在,更新它
174 let obj = JSON.parse(existingCookie); 174 let obj = JSON.parse(existingCookie);
175 obj[props.item.key] = currentValue; // 替换掉旧值 175 obj[props.item.key] = currentValue; // 替换掉旧值
176 - Cookies.set($route.query.code, JSON.stringify(obj)); 176 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
177 } else { 177 } else {
178 // 如果Cookie不存在,新增它 178 // 如果Cookie不存在,新增它
179 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 179 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
180 } 180 }
181 } 181 }
182 ); 182 );
......
1 <!-- 1 <!--
2 * @Date: 2022-08-31 11:45:30 2 * @Date: 2022-08-31 11:45:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-12 17:54:17 4 + * @LastEditTime: 2024-11-21 13:14:46
5 * @FilePath: /data-table/src/components/DatePickerField/index.vue 5 * @FilePath: /data-table/src/components/DatePickerField/index.vue
6 * @Description: 日期选择组件 6 * @Description: 日期选择组件
7 --> 7 -->
...@@ -78,10 +78,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => { ...@@ -78,10 +78,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => {
78 // 如果Cookie存在,更新它 78 // 如果Cookie存在,更新它
79 let obj = JSON.parse(existingCookie); 79 let obj = JSON.parse(existingCookie);
80 obj[props.item.key] = currentValue; // 替换掉旧值 80 obj[props.item.key] = currentValue; // 替换掉旧值
81 - Cookies.set($route.query.code, JSON.stringify(obj)); 81 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
82 } else { 82 } else {
83 // 如果Cookie不存在,新增它 83 // 如果Cookie不存在,新增它
84 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 84 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
85 } 85 }
86 }; 86 };
87 87
......
...@@ -80,10 +80,10 @@ const onConfirm = () => { ...@@ -80,10 +80,10 @@ const onConfirm = () => {
80 // 如果Cookie存在,更新它 80 // 如果Cookie存在,更新它
81 let obj = JSON.parse(existingCookie); 81 let obj = JSON.parse(existingCookie);
82 obj[props.item.key] = currentValue; // 替换掉旧值 82 obj[props.item.key] = currentValue; // 替换掉旧值
83 - Cookies.set($route.query.code, JSON.stringify(obj)); 83 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
84 } else { 84 } else {
85 // 如果Cookie不存在,新增它 85 // 如果Cookie不存在,新增它
86 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 86 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
87 } 87 }
88 }; 88 };
89 const onCancel = () => { 89 const onCancel = () => {
......
...@@ -75,10 +75,10 @@ const onBlur = (item) => { ...@@ -75,10 +75,10 @@ const onBlur = (item) => {
75 // 如果Cookie存在,更新它 75 // 如果Cookie存在,更新它
76 let obj = JSON.parse(existingCookie); 76 let obj = JSON.parse(existingCookie);
77 obj[props.item.key] = currentValue; // 替换掉旧值 77 obj[props.item.key] = currentValue; // 替换掉旧值
78 - Cookies.set($route.query.code, JSON.stringify(obj)); 78 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
79 } else { 79 } else {
80 // 如果Cookie不存在,新增它 80 // 如果Cookie不存在,新增它
81 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 81 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
82 } 82 }
83 } 83 }
84 </script> 84 </script>
......
1 <!-- 1 <!--
2 * @Date: 2022-08-30 11:34:19 2 * @Date: 2022-08-30 11:34:19
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-19 15:21:52 4 + * @LastEditTime: 2024-11-21 13:15:05
5 * @FilePath: /data-table/src/components/GenderField/index.vue 5 * @FilePath: /data-table/src/components/GenderField/index.vue
6 * @Description: 性别选择控件 6 * @Description: 性别选择控件
7 --> 7 -->
...@@ -93,10 +93,10 @@ const onChange = (item) => { ...@@ -93,10 +93,10 @@ const onChange = (item) => {
93 // 如果Cookie存在,更新它 93 // 如果Cookie存在,更新它
94 let obj = JSON.parse(existingCookie); 94 let obj = JSON.parse(existingCookie);
95 obj[props.item.key] = currentValue; // 替换掉旧值 95 obj[props.item.key] = currentValue; // 替换掉旧值
96 - Cookies.set($route.query.code, JSON.stringify(obj)); 96 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
97 } else { 97 } else {
98 // 如果Cookie不存在,新增它 98 // 如果Cookie不存在,新增它
99 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 99 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
100 } 100 }
101 } 101 }
102 </script> 102 </script>
......
...@@ -322,10 +322,10 @@ const onBlur = (item) => { ...@@ -322,10 +322,10 @@ const onBlur = (item) => {
322 // 如果Cookie存在,更新它 322 // 如果Cookie存在,更新它
323 let obj = JSON.parse(existingCookie); 323 let obj = JSON.parse(existingCookie);
324 obj[props.item.key] = currentValue; // 替换掉旧值 324 obj[props.item.key] = currentValue; // 替换掉旧值
325 - Cookies.set($route.query.code, JSON.stringify(obj)); 325 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
326 } else { 326 } else {
327 // 如果Cookie不存在,新增它 327 // 如果Cookie不存在,新增它
328 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 328 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
329 } 329 }
330 } 330 }
331 </script> 331 </script>
......
...@@ -137,10 +137,10 @@ watch( ...@@ -137,10 +137,10 @@ watch(
137 // 如果Cookie存在,更新它 137 // 如果Cookie存在,更新它
138 let obj = JSON.parse(existingCookie); 138 let obj = JSON.parse(existingCookie);
139 obj[props.item.key] = currentValue; // 替换掉旧值 139 obj[props.item.key] = currentValue; // 替换掉旧值
140 - Cookies.set($route.query.code, JSON.stringify(obj)); 140 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
141 } else { 141 } else {
142 // 如果Cookie不存在,新增它 142 // 如果Cookie不存在,新增它
143 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 143 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
144 } 144 }
145 } 145 }
146 ); 146 );
......
...@@ -79,10 +79,10 @@ const onBlur = (item) => { ...@@ -79,10 +79,10 @@ const onBlur = (item) => {
79 // 如果Cookie存在,更新它 79 // 如果Cookie存在,更新它
80 let obj = JSON.parse(existingCookie); 80 let obj = JSON.parse(existingCookie);
81 obj[props.item.key] = currentValue; // 替换掉旧值 81 obj[props.item.key] = currentValue; // 替换掉旧值
82 - Cookies.set($route.query.code, JSON.stringify(obj)); 82 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
83 } else { 83 } else {
84 // 如果Cookie不存在,新增它 84 // 如果Cookie不存在,新增它
85 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 85 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
86 } 86 }
87 } 87 }
88 </script> 88 </script>
......
...@@ -163,10 +163,10 @@ const blurKeyboard = () => { ...@@ -163,10 +163,10 @@ const blurKeyboard = () => {
163 // 如果Cookie存在,更新它 163 // 如果Cookie存在,更新它
164 let obj = JSON.parse(existingCookie); 164 let obj = JSON.parse(existingCookie);
165 obj[props.item.key] = currentValue; // 替换掉旧值 165 obj[props.item.key] = currentValue; // 替换掉旧值
166 - Cookies.set($route.query.code, JSON.stringify(obj)); 166 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
167 } else { 167 } else {
168 // 如果Cookie不存在,新增它 168 // 如果Cookie不存在,新增它
169 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 169 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
170 } 170 }
171 }; 171 };
172 172
......
...@@ -472,10 +472,10 @@ const onConfirmClick = () => { // 确定操作 ...@@ -472,10 +472,10 @@ const onConfirmClick = () => { // 确定操作
472 // 如果Cookie存在,更新它 472 // 如果Cookie存在,更新它
473 let obj = JSON.parse(existingCookie); 473 let obj = JSON.parse(existingCookie);
474 obj[props.key] = currentValue; // 替换掉旧值 474 obj[props.key] = currentValue; // 替换掉旧值
475 - Cookies.set($route.query.code, JSON.stringify(obj)); 475 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
476 } else { 476 } else {
477 // 如果Cookie不存在,新增它 477 // 如果Cookie不存在,新增它
478 - Cookies.set($route.query.code, JSON.stringify({ [props.key]: currentValue })); 478 + Cookies.set($route.query.code, JSON.stringify({ [props.key]: currentValue }), { expires: 1 });
479 } 479 }
480 } 480 }
481 481
......
...@@ -183,10 +183,10 @@ const onBlur = (item) => { ...@@ -183,10 +183,10 @@ const onBlur = (item) => {
183 // 如果Cookie存在,更新它 183 // 如果Cookie存在,更新它
184 let obj = JSON.parse(existingCookie); 184 let obj = JSON.parse(existingCookie);
185 obj[props.item.key] = currentValue; // 替换掉旧值 185 obj[props.item.key] = currentValue; // 替换掉旧值
186 - Cookies.set($route.query.code, JSON.stringify(obj)); 186 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
187 } else { 187 } else {
188 // 如果Cookie不存在,新增它 188 // 如果Cookie不存在,新增它
189 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 189 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
190 } 190 }
191 } 191 }
192 </script> 192 </script>
......
...@@ -56,10 +56,10 @@ const onActive = (val) => { ...@@ -56,10 +56,10 @@ const onActive = (val) => {
56 // 如果Cookie存在,更新它 56 // 如果Cookie存在,更新它
57 let obj = JSON.parse(existingCookie); 57 let obj = JSON.parse(existingCookie);
58 obj[props.item.key] = currentValue; // 替换掉旧值 58 obj[props.item.key] = currentValue; // 替换掉旧值
59 - Cookies.set($route.query.code, JSON.stringify(obj)); 59 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
60 } else { 60 } else {
61 // 如果Cookie不存在,新增它 61 // 如果Cookie不存在,新增它
62 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 62 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
63 } 63 }
64 }; 64 };
65 65
......
...@@ -186,10 +186,10 @@ watch( ...@@ -186,10 +186,10 @@ watch(
186 // 如果Cookie存在,更新它 186 // 如果Cookie存在,更新它
187 let obj = JSON.parse(existingCookie); 187 let obj = JSON.parse(existingCookie);
188 obj[props.item.key] = currentValue; // 替换掉旧值 188 obj[props.item.key] = currentValue; // 替换掉旧值
189 - Cookies.set($route.query.code, JSON.stringify(obj)); 189 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
190 } else { 190 } else {
191 // 如果Cookie不存在,新增它 191 // 如果Cookie不存在,新增它
192 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 192 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
193 } 193 }
194 } 194 }
195 ); 195 );
......
1 <!-- 1 <!--
2 * @Date: 2023-03-29 13:09:02 2 * @Date: 2023-03-29 13:09:02
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-21 09:53:59 4 + * @LastEditTime: 2024-11-21 13:16:03
5 * @FilePath: /data-table/src/components/RatePickerField/MyComponent.vue 5 * @FilePath: /data-table/src/components/RatePickerField/MyComponent.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -45,10 +45,10 @@ watch( ...@@ -45,10 +45,10 @@ watch(
45 // 如果Cookie存在,更新它 45 // 如果Cookie存在,更新它
46 let obj = JSON.parse(existingCookie); 46 let obj = JSON.parse(existingCookie);
47 obj[props.key] = currentValue; // 替换掉旧值 47 obj[props.key] = currentValue; // 替换掉旧值
48 - Cookies.set($route.query.code, JSON.stringify(obj)); 48 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
49 } else { 49 } else {
50 // 如果Cookie不存在,新增它 50 // 如果Cookie不存在,新增它
51 - Cookies.set($route.query.code, JSON.stringify({ [props.key]: currentValue })); 51 + Cookies.set($route.query.code, JSON.stringify({ [props.key]: currentValue }), { expires: 1 });
52 } 52 }
53 } 53 }
54 ); 54 );
......
...@@ -105,10 +105,10 @@ const onBlur = (html) => { ...@@ -105,10 +105,10 @@ const onBlur = (html) => {
105 // 如果Cookie存在,更新它 105 // 如果Cookie存在,更新它
106 let obj = JSON.parse(existingCookie); 106 let obj = JSON.parse(existingCookie);
107 obj[props.item.key] = currentValue; // 替换掉旧值 107 obj[props.item.key] = currentValue; // 替换掉旧值
108 - Cookies.set($route.query.code, JSON.stringify(obj)); 108 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
109 } else { 109 } else {
110 // 如果Cookie不存在,新增它 110 // 如果Cookie不存在,新增它
111 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 111 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
112 } 112 }
113 } 113 }
114 114
......
...@@ -77,10 +77,10 @@ const onBlur = (item) => { ...@@ -77,10 +77,10 @@ const onBlur = (item) => {
77 // 如果Cookie存在,更新它 77 // 如果Cookie存在,更新它
78 let obj = JSON.parse(existingCookie); 78 let obj = JSON.parse(existingCookie);
79 obj[props.item.key] = currentValue; // 替换掉旧值 79 obj[props.item.key] = currentValue; // 替换掉旧值
80 - Cookies.set($route.query.code, JSON.stringify(obj)); 80 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
81 } else { 81 } else {
82 // 如果Cookie不存在,新增它 82 // 如果Cookie不存在,新增它
83 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 83 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
84 } 84 }
85 }; 85 };
86 86
......
...@@ -70,10 +70,10 @@ const onBlur = (item) => { ...@@ -70,10 +70,10 @@ const onBlur = (item) => {
70 // 如果Cookie存在,更新它 70 // 如果Cookie存在,更新它
71 let obj = JSON.parse(existingCookie); 71 let obj = JSON.parse(existingCookie);
72 obj[props.item.key] = currentValue; // 替换掉旧值 72 obj[props.item.key] = currentValue; // 替换掉旧值
73 - Cookies.set($route.query.code, JSON.stringify(obj)); 73 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
74 } else { 74 } else {
75 // 如果Cookie不存在,新增它 75 // 如果Cookie不存在,新增它
76 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 76 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
77 } 77 }
78 } 78 }
79 </script> 79 </script>
......
1 <!-- 1 <!--
2 * @Date: 2022-08-31 11:45:30 2 * @Date: 2022-08-31 11:45:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-21 09:45:58 4 + * @LastEditTime: 2024-11-21 13:16:25
5 * @FilePath: /data-table/src/components/TimePickerField/index.vue 5 * @FilePath: /data-table/src/components/TimePickerField/index.vue
6 * @Description: 时间选择组件 6 * @Description: 时间选择组件
7 --> 7 -->
...@@ -67,10 +67,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => { ...@@ -67,10 +67,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => {
67 // 如果Cookie存在,更新它 67 // 如果Cookie存在,更新它
68 let obj = JSON.parse(existingCookie); 68 let obj = JSON.parse(existingCookie);
69 obj[props.item.key] = currentValue; // 替换掉旧值 69 obj[props.item.key] = currentValue; // 替换掉旧值
70 - Cookies.set($route.query.code, JSON.stringify(obj)); 70 + Cookies.set($route.query.code, JSON.stringify(obj), { expires: 1 });
71 } else { 71 } else {
72 // 如果Cookie不存在,新增它 72 // 如果Cookie不存在,新增它
73 - Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue })); 73 + Cookies.set($route.query.code, JSON.stringify({ [props.item.key]: currentValue }), { expires: 1 });
74 } 74 }
75 }; 75 };
76 76
......