Skip to content

Commit d8ece45

Browse files
committed
fix: 修复关闭系统动画效果后的动画样式异常
- Windows: 高级系统设置 → 性能 → 关闭“窗口内的动画控件和元素” - macOS: 辅助功能 → 显示 → 开启“减少动态效果”
1 parent daa4ede commit d8ece45

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store-front-end",
3-
"version": "2.15.84",
3+
"version": "2.15.85",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* 修复 modern-css-reset 在 prefers-reduced-motion 时的问题
3+
*
4+
* 问题:modern-css-reset 将动画/过渡时间设置为 0.01ms,这会导致:
5+
* 1. Notify 通知极快闪现
6+
* 2. 代码编辑器 cmView 滚动不跟手
7+
* 详见:https://github.com/sub-store-org/Sub-Store/issues/486
8+
* 解决方案:让动画和过渡完全禁用,针对性处理Notify和代码编辑器样式
9+
*/
10+
@media (prefers-reduced-motion: reduce) {
11+
*,
12+
*::before,
13+
*::after {
14+
animation-duration: 0s !important;
15+
animation-iteration-count: 1 !important;
16+
transition-duration: 0s !important;
17+
scroll-behavior: auto !important;
18+
}
19+
20+
/* 需要保持动画的元素:添加 .keep-motion 类或使用特定前缀 */
21+
.keep-motion,
22+
.keep-motion *,
23+
[class^="Toastify"],
24+
[class*=" Toastify"],
25+
[class^="nut-toast"],
26+
[class^="nut-overlay"] {
27+
animation-duration: 0.5s !important;
28+
transition-duration: 0.5s !important;
29+
}
30+
31+
// NutUI Toast.loading 动画
32+
.nut-toast-loading .nut-toast-icon-wrapper {
33+
animation: rotation 1s linear infinite !important;
34+
}
35+
36+
.cmviewRef,
37+
.cm-scroller {
38+
scroll-behavior: auto !important;
39+
}
40+
}

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import '@/plugin/touch.js'
1313
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
1414

1515
import 'modern-css-reset/dist/reset.min.css';
16+
import '@/assets/styles/reduced-motion-fix.scss';
1617
import { createPinia } from 'pinia';
1718
import 'virtual:svg-icons-register';
1819
import { createApp } from 'vue';

0 commit comments

Comments
 (0)