fix: FullCalendar getApi null 引用保护
Frontend CI / build (push) Failing after 14m22s
Frontend CI / build (push) Failing after 14m22s
draw()/redraw()/freeze() 在组件卸载后可能被异步触发, 添加 calendar.value null 检查防止 TypeError。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -625,6 +625,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const redraw = () => {
|
||||
if (!calendar.value) { console.debug('[clazz redraw] skip, calendar null'); return; }
|
||||
let events = calendar.value.getApi().getEvents();
|
||||
events.forEach((event, i) => {
|
||||
let subsidiary_id = event.extendedProps.subsidiary_id;
|
||||
@@ -894,6 +895,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const freeze = () => {
|
||||
if (!calendar.value) return;
|
||||
store.hanging = true;
|
||||
let date = calendar.value.getApi().getDate();
|
||||
setKey('clazz_state', {state, date})
|
||||
|
||||
Reference in New Issue
Block a user