refactor: fix type error
This commit is contained in:
parent
61f63f368d
commit
310e68c0e3
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (footerEl.value != null) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
Loading…
Reference in New Issue