refactor: fix type error

This commit is contained in:
yukineko 2024-01-05 01:23:53 +09:00
parent 61f63f368d
commit 310e68c0e3
No known key found for this signature in database
GPG Key ID: E5BACB72109B7B90
2 changed files with 16 additions and 11 deletions

View File

@ -49,7 +49,7 @@ type MfmEvents = {
};
// eslint-disable-next-line import/no-default-export
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
const isNote = props.isNote ?? true;
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
@ -292,7 +292,7 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
ev.stopPropagation();
ev.preventDefault();
const clickEv = typeof token.props.args.ev === 'string' ? token.props.args.ev : '';
context.emit('clickEv', clickEv);
emit('clickEv', clickEv);
} }, genEl(token.children, scale));
}
}

View File

@ -63,27 +63,32 @@ onMounted(() => {
watch([parentStickyTop, parentStickyBottom], calc);
watch(childStickyTop, () => {
if (bodyEl.value == null) return;
bodyEl.value.style.setProperty('--stickyTop', `${childStickyTop.value}px`);
}, {
immediate: true,
});
watch(childStickyBottom, () => {
if (bodyEl.value == null) return;
bodyEl.value.style.setProperty('--stickyBottom', `${childStickyBottom.value}px`);
}, {
immediate: true,
});
headerEl.value.style.position = 'sticky';
headerEl.value.style.top = 'var(--stickyTop, 0)';
headerEl.value.style.zIndex = '1000';
if (headerEl.value != null) {
headerEl.value.style.position = 'sticky';
headerEl.value.style.top = 'var(--stickyTop, 0)';
headerEl.value.style.zIndex = '1000';
observer.observe(headerEl.value);
}
footerEl.value.style.position = 'sticky';
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
footerEl.value.style.zIndex = '1000';
observer.observe(headerEl.value);
observer.observe(footerEl.value);
if (footerEl.value != null) {
footerEl.value.style.position = 'sticky';
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
footerEl.value.style.zIndex = '1000';
observer.observe(footerEl.value);
}
});
onUnmounted(() => {