npmapps 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/app/wujie-vue2-child/.eslintrc.js +19 -0
  2. package/app/wujie-vue2-child/README.md +24 -0
  3. package/app/wujie-vue2-child/babel.config.js +5 -0
  4. package/app/wujie-vue2-child/docs/superpowers/plans/2026-05-29-quill-editor.md +836 -0
  5. package/app/wujie-vue2-child/docs/superpowers/specs/2026-05-29-quill-editor-design.md +210 -0
  6. package/app/wujie-vue2-child/jsconfig.json +19 -0
  7. package/app/wujie-vue2-child/package-lock.json +21333 -0
  8. package/app/wujie-vue2-child/package.json +63 -0
  9. package/app/wujie-vue2-child/postcss.config.js +10 -0
  10. package/app/wujie-vue2-child/public/favicon.ico +0 -0
  11. package/app/wujie-vue2-child/public/index.html +17 -0
  12. package/app/wujie-vue2-child/public/rili.jpg +0 -0
  13. package/app/wujie-vue2-child/public//344/270/200/351/224/256/351/273/221/346/232/227.html +136 -0
  14. package/app/wujie-vue2-child/src/App.vue +110 -0
  15. package/app/wujie-vue2-child/src/assets/bpmn-camunda.jpg +0 -0
  16. package/app/wujie-vue2-child/src/assets/css/diagram.less +17 -0
  17. package/app/wujie-vue2-child/src/assets/icon/Icon.less +31 -0
  18. package/app/wujie-vue2-child/src/assets/icon/font/app-codes.css +26 -0
  19. package/app/wujie-vue2-child/src/assets/icon/font/app.eot +0 -0
  20. package/app/wujie-vue2-child/src/assets/icon/font/app.svg +60 -0
  21. package/app/wujie-vue2-child/src/assets/icon/font/app.ttf +0 -0
  22. package/app/wujie-vue2-child/src/assets/icon/font/app.woff +0 -0
  23. package/app/wujie-vue2-child/src/assets/icon/font/app.woff2 +0 -0
  24. package/app/wujie-vue2-child/src/assets/icon/font/config.json +248 -0
  25. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-bottom-tool.svg +30 -0
  26. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-horizontal-center-tool.svg +85 -0
  27. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-left-tool.svg +84 -0
  28. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-right-tool.svg +80 -0
  29. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-top-tool.svg +84 -0
  30. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-vertical-center-tool.svg +89 -0
  31. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-horizontally-tool.svg +95 -0
  32. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-vertically-tool.svg +99 -0
  33. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/set-color-tool.svg +111 -0
  34. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-bottom-tool.svg +30 -0
  35. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-horizontal-center-tool.svg +30 -0
  36. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-left-tool.svg +30 -0
  37. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-right-tool.svg +30 -0
  38. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-top-tool.svg +30 -0
  39. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-vertical-center-tool.svg +30 -0
  40. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-horizontally-tool.svg +30 -0
  41. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-vertically-tool.svg +30 -0
  42. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/set-color-tool.svg +63 -0
  43. package/app/wujie-vue2-child/src/assets/logo.png +0 -0
  44. package/app/wujie-vue2-child/src/components/EllTable/README.md +70 -0
  45. package/app/wujie-vue2-child/src/components/EllTable/article.md +184 -0
  46. package/app/wujie-vue2-child/src/components/EllTable/index.js +213 -0
  47. package/app/wujie-vue2-child/src/components/EventCalendar/CalendarSkeleton.vue +147 -0
  48. package/app/wujie-vue2-child/src/components/EventCalendar/CodeBlock.vue +199 -0
  49. package/app/wujie-vue2-child/src/components/EventCalendar/MonthSelect.vue +376 -0
  50. package/app/wujie-vue2-child/src/components/EventCalendar/README.md +368 -0
  51. package/app/wujie-vue2-child/src/components/EventCalendar/example.vue +1551 -0
  52. package/app/wujie-vue2-child/src/components/EventCalendar/index.vue +1646 -0
  53. package/app/wujie-vue2-child/src/components/EventCalendar/mockData.js +349 -0
  54. package/app/wujie-vue2-child/src/components/EventCalendar/utils.js +201 -0
  55. package/app/wujie-vue2-child/src/components/FormulaEditor/FunctionSelector.vue +123 -0
  56. package/app/wujie-vue2-child/src/components/FormulaEditor/OperatorSelector.vue +184 -0
  57. package/app/wujie-vue2-child/src/components/FormulaEditor/ParameterSelector.vue +123 -0
  58. package/app/wujie-vue2-child/src/components/FormulaEditor/api.js +69 -0
  59. package/app/wujie-vue2-child/src/components/FormulaEditor/index.vue +435 -0
  60. package/app/wujie-vue2-child/src/components/HelloWorld.vue +58 -0
  61. package/app/wujie-vue2-child/src/components/PageHeader/index.vue +158 -0
  62. package/app/wujie-vue2-child/src/components/Splitter/README.md +144 -0
  63. package/app/wujie-vue2-child/src/components/Splitter/example.vue +84 -0
  64. package/app/wujie-vue2-child/src/components/Splitter/index.vue +203 -0
  65. package/app/wujie-vue2-child/src/components/diagram/ToolBar.vue +357 -0
  66. package/app/wujie-vue2-child/src/components/diagram/customTranslate/customTranslate.js +12 -0
  67. package/app/wujie-vue2-child/src/components/diagram/customTranslate/translationsGerman.js +241 -0
  68. package/app/wujie-vue2-child/src/components/diagram/index.vue +261 -0
  69. package/app/wujie-vue2-child/src/components/diagram/xmlData.js +29 -0
  70. package/app/wujie-vue2-child/src/directives/filldown.js +155 -0
  71. package/app/wujie-vue2-child/src/directives/filldownTable.js +291 -0
  72. package/app/wujie-vue2-child/src/main.js +40 -0
  73. package/app/wujie-vue2-child/src/router/index.js +72 -0
  74. package/app/wujie-vue2-child/src/store/index.js +23 -0
  75. package/app/wujie-vue2-child/src/utils/winBox.js +23 -0
  76. package/app/wujie-vue2-child/src/views/Extend/A.vue +12 -0
  77. package/app/wujie-vue2-child/src/views/Extend/B.vue +10 -0
  78. package/app/wujie-vue2-child/src/views/Extend/MagicalComponentsForELFormItem.vue +78 -0
  79. package/app/wujie-vue2-child/src/views/Extend/index.vue +59 -0
  80. package/app/wujie-vue2-child/src/views/Extend/tableMouseHorizontalWheel.vue +184 -0
  81. package/app/wujie-vue2-child/src/views/Home.vue +27 -0
  82. package/app/wujie-vue2-child/src/views/RouterJump.vue +145 -0
  83. package/app/wujie-vue2-child/src/views/calendar/index.vue +19 -0
  84. package/app/wujie-vue2-child/src/views/css.vue +57 -0
  85. package/app/wujie-vue2-child/src/views/cssComponents/EllipsisText.vue +73 -0
  86. package/app/wujie-vue2-child/src/views/cssComponents/HoverCard.vue +69 -0
  87. package/app/wujie-vue2-child/src/views/cssComponents/TableHover.vue +130 -0
  88. package/app/wujie-vue2-child/src/views/cssComponents/inputSlo.vue +42 -0
  89. package/app/wujie-vue2-child/src/views/cssComponents/tableFixed.vue +148 -0
  90. package/app/wujie-vue2-child/src/views/echarts/echart-dome.vue +73 -0
  91. package/app/wujie-vue2-child/src/views/echarts/index.vue +118 -0
  92. package/app/wujie-vue2-child/src/views/echarts/pei3d.vue +658 -0
  93. package/app/wujie-vue2-child/src/views/element/bpmn/index.vue +15 -0
  94. package/app/wujie-vue2-child/src/views/element/components/attendanceCycle/index.vue +131 -0
  95. package/app/wujie-vue2-child/src/views/element/components/attendanceGroup/index.vue +147 -0
  96. package/app/wujie-vue2-child/src/views/element/components/attendancePersonnel/index.vue +158 -0
  97. package/app/wujie-vue2-child/src/views/element/components/companyCalendar/index.vue +147 -0
  98. package/app/wujie-vue2-child/src/views/element/components/shift/index.vue +147 -0
  99. package/app/wujie-vue2-child/src/views/element/components/shiftRotationSystem/index.vue +147 -0
  100. package/app/wujie-vue2-child/src/views/element/elTableJsx/columnManagement.vue +340 -0
  101. package/app/wujie-vue2-child/src/views/element/elTableJsx/dialogInput.vue +71 -0
  102. package/app/wujie-vue2-child/src/views/element/elTableJsx/elTableJsx.vue +1826 -0
  103. package/app/wujie-vue2-child/src/views/element/elTableJsx/formTable.vue +595 -0
  104. package/app/wujie-vue2-child/src/views/element/elTableJsx/index.vue +29 -0
  105. package/app/wujie-vue2-child/src/views/element/elTableJsx/simpleTable.vue +189 -0
  106. package/app/wujie-vue2-child/src/views/element/elTableJsx.zip +0 -0
  107. package/app/wujie-vue2-child/src/views/element/index.vue +39 -0
  108. package/app/wujie-vue2-child/src/views/element/quillEditor/README.md +163 -0
  109. package/app/wujie-vue2-child/src/views/element/quillEditor/example.vue +307 -0
  110. package/app/wujie-vue2-child/src/views/element/quillEditor/index.vue +409 -0
  111. package/app/wujie-vue2-child/src/views/element/quillEditor/toolbar.js +122 -0
  112. package/app/wujie-vue2-child/vue.config.js +15 -0
  113. package/package.json +1 -1
  114. package/app/html-note(1).zip +0 -0
@@ -0,0 +1,368 @@
1
+ # EventCalendar 日程日历组件
2
+
3
+ 一个零第三方依赖的 Vue 2 月历组件。支持月份自动补全(含跨年)、下拉切换、自动轮播、
4
+ 字段映射、插槽定制、骨架屏与多种切换动效。
5
+
6
+ > 整个 `EventCalendar` 文件夹可以直接拷贝到任意 Vue 2 项目使用,
7
+ > **不依赖 element-ui / dayjs / moment / lodash 等任何第三方库**,只用原生 `Date` 与 CSS。
8
+
9
+ ## 目录结构
10
+
11
+ ```
12
+ EventCalendar/
13
+ ├── index.vue # 组件本体
14
+ ├── MonthSelect.vue # 自研月份下拉框(不依赖 UI 库)
15
+ ├── CalendarSkeleton.vue # 骨架屏
16
+ ├── CodeBlock.vue # 示例页用的代码块(业务中可删)
17
+ ├── utils.js # 日期计算与字段映射工具
18
+ ├── mockData.js # 模拟数据(setTimeout 模拟异步接口)
19
+ ├── example.vue # 完整示例集合(12 个 demo + API 文档)
20
+ └── README.md
21
+ ```
22
+
23
+ 真正接入业务时,**必需**的只有 `index.vue`、`MonthSelect.vue`、`CalendarSkeleton.vue`、`utils.js`。
24
+ `mockData.js` / `example.vue` / `CodeBlock.vue` 是演示用的,可以删掉。
25
+
26
+ ## 快速开始
27
+
28
+ ```vue
29
+ <template>
30
+ <EventCalendar
31
+ :data="data"
32
+ :loading="loading"
33
+ title="宣讲日历"
34
+ subtitle="更多场次陆续上线中,宣讲进程以实际安排为准"
35
+ @item-click="onItemClick"
36
+ />
37
+ </template>
38
+
39
+ <script>
40
+ import EventCalendar from '@/components/EventCalendar/index.vue'
41
+
42
+ export default {
43
+ components: { EventCalendar },
44
+ data() {
45
+ return { data: [], loading: true }
46
+ },
47
+ async created() {
48
+ this.loading = true
49
+ try {
50
+ this.data = await this.$api.getCalendar()
51
+ } finally {
52
+ // 放 finally:接口失败也要收掉骨架屏,否则页面会一直卡在加载态
53
+ this.loading = false
54
+ }
55
+ },
56
+ methods: {
57
+ onItemClick(scope) {
58
+ console.log(scope.item) // 后端返回的原始对象
59
+ }
60
+ }
61
+ }
62
+ </script>
63
+ ```
64
+
65
+ ## 数据结构
66
+
67
+ ### 默认结构(按月分组)
68
+
69
+ ```js
70
+ [
71
+ {
72
+ month: '2026-09', // 月份标识
73
+ monthLabel: '2026年9月', // 下拉框文案,不传则自动生成
74
+ days: [
75
+ {
76
+ date: '2026-09-09', // 日期标识
77
+ items: [ // 当天的条目
78
+ {
79
+ id: 'a1',
80
+ label: '香港中文大学(深圳)', // 主文案
81
+ badge: '宣讲', // 右上角角标
82
+ type: 'talk' // 类型,决定配色
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ ```
90
+
91
+ ### 扁平结构(也支持)
92
+
93
+ 不按月分组,直接给一维日期数组,组件会自动按日期归月:
94
+
95
+ ```js
96
+ [
97
+ { date: '2026-09-09', items: [...] },
98
+ { date: '2026-10-01', items: [...] }
99
+ ]
100
+ ```
101
+
102
+ ## 字段映射(后端字段不一致时)
103
+
104
+ **不需要改数据**,传 `field-names` 即可。字段路径支持 `'a.b.c'` 形式。
105
+
106
+ ```js
107
+ const fieldNames = {
108
+ month: 'ym',
109
+ monthLabel: 'ymText',
110
+ days: 'dateList',
111
+ date: 'dayStr',
112
+ items: 'activityList',
113
+ itemKey: 'activityId',
114
+ itemLabel: 'schoolName',
115
+ itemBadge: 'activityTypeName',
116
+ itemType: 'activityType',
117
+ itemDisabled: 'expired'
118
+ }
119
+ ```
120
+
121
+ ```vue
122
+ <EventCalendar :data="data" :field-names="fieldNames" />
123
+ ```
124
+
125
+ 完整默认值见 `utils.js` 里的 `DEFAULT_FIELD_NAMES`。
126
+
127
+ ## 核心机制说明
128
+
129
+ ### 1. 月份补全与跨年
130
+
131
+ 每个月天数(28/29/30/31)和「1 号是星期几」都不固定,组件会自动补齐首尾:
132
+
133
+ - 若 2 月 1 号是**周三**,首行补上 1 月的周日、周一、周二;
134
+ - 若 2 月 28 号是**周三**,末行补上 3 月的周四、周五、周六;
135
+ - 非当月的补位日期自动**置灰**(`.is-other-month`)。
136
+
137
+ 实现上先算出本月 1 号相对「一周起始日」的偏移量 `leading`,再用
138
+ `new Date(year, month - 1, 1 - leading + i)` 递推生成所有格子。
139
+ 原生 `Date` 对天数越界会自动进位/借位,**跨年(1 月往前补 12 月、12 月往后补次年 1 月)无需任何特判**。
140
+
141
+ 补位格子默认也会渲染条目,可用 `:show-adjacent-items="false"` 关掉。
142
+
143
+ ### 2. 行高与条目溢出
144
+
145
+ **行高由该行条目最多的那一天决定** —— 这是 CSS Grid 的天然行为
146
+ (同一行的格子会自动拉伸到该行最高格子的高度),无需 JS 计算,也不会因为窗口缩放而失准。
147
+
148
+ 单日条目超过 `max-visible-items`(默认 4)后有两种处理:
149
+
150
+ | overflow-mode | 行为 |
151
+ | --- | --- |
152
+ | `scroll`(默认) | 格内出现细滚动条,滚动区高度 = `n × item-height + (n-1) × item-gap` |
153
+ | `collapse` | 只显示前 n-1 条,末尾出现「还有 N 项」,可监听 `more-click` |
154
+
155
+ `min-row-height` 保证没有条目的行不会塌陷。
156
+
157
+ ### 3. 轮播与暂停
158
+
159
+ `autoplay` 开启后按 `autoplay-interval` 自动切换月份,顶部细进度条展示剩余时间。
160
+ 以下情况会**自动暂停并保留剩余时间**(恢复时接着走,进度条不跳):
161
+
162
+ - 鼠标悬停在组件上(`pause-on-hover`,默认开)
163
+ - 月份下拉框展开中
164
+ - 浏览器标签页切到后台(`visibilitychange`)
165
+ - 用户点击了暂停按钮
166
+
167
+ `loop="false"` 时播到最后一个月会停止并触发 `autoplay-end`。
168
+
169
+ ### 4. 切换动效
170
+
171
+ | transition-effect | 效果 |
172
+ | --- | --- |
173
+ | `slide`(默认) | 按切换方向左右滑入滑出 |
174
+ | `fade` | 淡入淡出 |
175
+ | `zoom` | 缩放 |
176
+ | `flip` | 带透视的 3D 翻页 |
177
+ | `none` | 关闭动效 |
178
+
179
+ 另有 `cell-stagger` 让单元格从左上到右下错峰入场。
180
+ 动效时长由 `transition-duration` 控制,设为 `0` 亦可视作关闭。
181
+
182
+ 切月时行数可能从 5 行变 6 行,组件用 `ResizeObserver` 测量面板高度并做高度过渡,不会突然跳动。
183
+
184
+ > 组件已适配 `prefers-reduced-motion`:系统开启「减少动态效果」时自动关闭全部动画。
185
+
186
+ ## API
187
+
188
+ ### Props
189
+
190
+ | 参数 | 说明 | 类型 | 默认值 |
191
+ | --- | --- | --- | --- |
192
+ | data | 日历数据,支持按月分组与扁平两种结构 | Array | `[]` |
193
+ | field-names | 字段映射,支持 `a.b.c` 点路径 | Object | `{}` |
194
+ | loading | 加载中,为 true 时渲染骨架屏 | Boolean | `false` |
195
+ | skeleton-rows | 骨架屏行数 | Number | `5` |
196
+ | active-month | 当前月份,支持 `v-model` / `.sync` | String | `''` |
197
+ | show-month-select | 是否显示月份下拉框 | Boolean | `true` |
198
+ | show-arrows | 是否显示左右翻月箭头 | Boolean | `false` |
199
+ | autoplay | 是否开启自动轮播 | Boolean | `false` |
200
+ | autoplay-interval | 轮播间隔(毫秒) | Number | `60000` |
201
+ | loop | 播到最后一个月后是否回到第一个 | Boolean | `true` |
202
+ | pause-on-hover | 鼠标悬停时暂停轮播 | Boolean | `true` |
203
+ | show-progress | 显示轮播倒计时进度条 | Boolean | `true` |
204
+ | show-autoplay-toggle | 显示播放/暂停按钮 | Boolean | `true` |
205
+ | transition-effect | `slide` / `fade` / `zoom` / `flip` / `none` | String | `'slide'` |
206
+ | transition-duration | 动效时长(毫秒) | Number | `420` |
207
+ | cell-stagger | 单元格错峰入场动画 | Boolean | `false` |
208
+ | show-header | 是否显示顶部区域 | Boolean | `true` |
209
+ | title / subtitle | 默认标题与副标题(`header-left` 未传时生效) | String | `''` |
210
+ | first-day-of-week | 一周起始日,0=周日 1=周一 | Number | `0` |
211
+ | week-labels | 星期文案,下标对应 `Date.getDay()` | Array | `['周日'…'周六']` |
212
+ | max-visible-items | 单日最多显示条目数 | Number | `4` |
213
+ | overflow-mode | 溢出处理:`scroll` / `collapse` | String | `'scroll'` |
214
+ | item-height | 单条条目高度(px) | Number | `28` |
215
+ | item-gap | 条目间距(px) | Number | `6` |
216
+ | min-row-height | 单元格最小高度(px) | Number | `118` |
217
+ | show-adjacent-items | 补位日期是否也渲染条目 | Boolean | `true` |
218
+ | highlight-today | 高亮今天 | Boolean | `true` |
219
+ | colorful | 角标是否按 type 上色 | Boolean | `true` |
220
+ | type-colors | 类型配色 `{ type: { color, bg } }` | Object | 内置 4 种 |
221
+ | day-formatter | 日期文案格式化 `(cell) => string` | Function | `'9月7日'` |
222
+ | month-formatter | 月份下拉文案格式化 `(monthKey, raw) => string` | Function | `null` |
223
+ | empty-text | 空数据文案 | String | `'暂无日程数据'` |
224
+ | cell-focusable | 单元格可聚焦(键盘无障碍) | Boolean | `false` |
225
+ | theme | 主题变量覆盖 | Object | `{}` |
226
+
227
+ ### Events
228
+
229
+ | 事件名 | 说明 | 回调参数 |
230
+ | --- | --- | --- |
231
+ | day-click | 点击日期格子 | `(scope, event)` |
232
+ | item-click | 点击条目 | `(scope, event)` |
233
+ | tag-click | 点击条目右上角角标;**未监听时自动退化为 item-click** | `(scope, event)` |
234
+ | more-click | `collapse` 模式下点击「还有 N 项」 | `(scope, event)` |
235
+ | month-change | 月份变化 | `(month, { index, source, option, raw })` |
236
+ | update:activeMonth | 配合 `v-model` / `.sync` | `(month)` |
237
+ | autoplay-toggle | 点击播放/暂停按钮 | `(playing: Boolean)` |
238
+ | autoplay-end | `loop=false` 时播到最后一个月 | — |
239
+ | transition-end | 月份切换动画结束 | `(month)` |
240
+
241
+ `month-change` 的 `source` 表明触发来源:`select` / `arrow` / `autoplay` / `prop` / `api`。
242
+
243
+ 日期格子的 `scope`:
244
+
245
+ ```js
246
+ { day, date, dateKey, items, visibleItems, raw, isCurrentMonth, isToday, isWeekend, label }
247
+ ```
248
+
249
+ 条目的 `scope`:
250
+
251
+ ```js
252
+ { item, raw, label, badge, type, disabled, index, day, dateKey }
253
+ ```
254
+
255
+ 其中 `item` / `raw` 是后端返回的**原始对象**,字段齐全,不受 `field-names` 影响。
256
+
257
+ ### Slots
258
+
259
+ | 名称 | 说明 | 作用域参数 |
260
+ | --- | --- | --- |
261
+ | header-left | 顶部左侧(设计稿的标题区) | `{ month, monthLabel, monthIndex, monthCount, monthOptions, loading, paused, prev, next, goTo, toggleAutoplay }` |
262
+ | header-right | 顶部右侧,整体替换默认按钮与下拉 | 同上 |
263
+ | weekday | 星期表头单元 | `{ label, weekday, isWeekend, index }` |
264
+ | day | 整个日期格子(覆盖所有默认内容) | 日期 scope |
265
+ | day-header | 格子里的日期行 | 日期 scope |
266
+ | items | 格子里的条目列表区域 | 日期 scope |
267
+ | item | 单个条目 | 条目 scope |
268
+ | day-empty | 当天无数据时的占位 | 日期 scope |
269
+ | loading | 自定义骨架屏 | `{ rows }` |
270
+ | empty | 整体空状态 | — |
271
+
272
+ 不传插槽时全部回落到默认样式(即设计稿效果)。
273
+
274
+ ```vue
275
+ <EventCalendar :data="data">
276
+ <template #header-left="{ monthLabel }">
277
+ <div class="my-head">{{ monthLabel }}</div>
278
+ </template>
279
+
280
+ <template #item="{ item, label, badge }">
281
+ <div class="my-item">{{ item.startTime }} {{ label }} · {{ badge }}</div>
282
+ </template>
283
+ </EventCalendar>
284
+ ```
285
+
286
+ ### Methods(通过 `ref` 调用)
287
+
288
+ | 方法 | 说明 |
289
+ | --- | --- |
290
+ | `prev()` | 切到上一个月 |
291
+ | `next()` | 切到下一个月 |
292
+ | `goTo(index)` | 切到第 index 个月(从 0 开始) |
293
+ | `setMonth(month)` | 切到指定月份,如 `setMonth('2026-10')` |
294
+ | `restartAutoplay()` | 重置轮播计时 |
295
+
296
+ ## 主题定制
297
+
298
+ 所有颜色都走 CSS 变量,用 `theme` 传入即可换肤:
299
+
300
+ ```vue
301
+ <EventCalendar
302
+ :data="data"
303
+ :theme="{
304
+ primary: '#10a37f',
305
+ primaryGhost: 'rgba(16,163,127,.12)',
306
+ border: '#e4e7ed',
307
+ borderLight: '#eef0f4',
308
+ text: '#303133',
309
+ textSecondary: '#606266',
310
+ muted: '#c8ccd4',
311
+ itemBg: '#f2f9f6',
312
+ cellHover: '#f7fcfa',
313
+ radius: '10px'
314
+ }"
315
+ />
316
+ ```
317
+
318
+ 按业务类型配色用 `type-colors`:
319
+
320
+ ```vue
321
+ <EventCalendar
322
+ :data="data"
323
+ :type-colors="{
324
+ talk: { color: '#3d6cf0', bg: 'rgba(61,108,240,.10)' },
325
+ fair: { color: '#e0821b', bg: 'rgba(224,130,27,.12)' }
326
+ }"
327
+ />
328
+ ```
329
+
330
+ `:colorful="false"` 会让角标统一回到中性灰(更贴近原始设计稿)。
331
+
332
+ ## 模拟数据
333
+
334
+ `mockData.js` 用 `setTimeout` 模拟异步接口,方便脱离后端联调:
335
+
336
+ ```js
337
+ import {
338
+ fetchCalendarData, // 默认字段,可指定月份 / 延迟 / 数据密度
339
+ fetchCalendarDataV2, // 字段名完全不同,配合 ALT_FIELD_NAMES 演示映射
340
+ fetchCrossYearData, // 2025-12 / 2026-01 / 2026-02,验证跨年补全
341
+ fetchEmptyData, // 空数据
342
+ SIMPLE_DATA, // 一份写死的小数据
343
+ ALT_FIELD_NAMES
344
+ } from './mockData'
345
+
346
+ const data = await fetchCalendarData({
347
+ months: ['2026-09', '2026-10'],
348
+ delay: 1500,
349
+ maxItems: 6,
350
+ density: 0.62
351
+ })
352
+ ```
353
+
354
+ 数据用固定种子的伪随机生成,**每次刷新结果一致**,方便调样式和截图对比。
355
+
356
+ ## 示例页
357
+
358
+ `example.vue` 是按 UI 组件库文档形式组织的完整示例集合,包含 12 个可交互 demo
359
+ (基础用法、异步骨架屏、多月切换、自动轮播、切换动效、跨年补全、字段映射、
360
+ 溢出与行高、插槽定制、事件、主题、空状态)与完整 API 表格。
361
+
362
+ 本项目中已挂到路由 `/calendar`。
363
+
364
+ ## 浏览器兼容
365
+
366
+ - 依赖 CSS Grid、CSS 自定义属性 —— 现代浏览器均支持,不支持 IE11;
367
+ - `ResizeObserver` 用于高度过渡,缺失时自动降级(高度不做动画,功能不受影响);
368
+ - 复制代码在非 HTTPS 环境会回退到 `document.execCommand`。