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
|
// 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 isNote = props.isNote ?? true;
|
||||||
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
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.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const clickEv = typeof token.props.args.ev === 'string' ? token.props.args.ev : '';
|
const clickEv = typeof token.props.args.ev === 'string' ? token.props.args.ev : '';
|
||||||
context.emit('clickEv', clickEv);
|
emit('clickEv', clickEv);
|
||||||
} }, genEl(token.children, scale));
|
} }, genEl(token.children, scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,27 +63,32 @@ onMounted(() => {
|
||||||
watch([parentStickyTop, parentStickyBottom], calc);
|
watch([parentStickyTop, parentStickyBottom], calc);
|
||||||
|
|
||||||
watch(childStickyTop, () => {
|
watch(childStickyTop, () => {
|
||||||
|
if (bodyEl.value == null) return;
|
||||||
bodyEl.value.style.setProperty('--stickyTop', `${childStickyTop.value}px`);
|
bodyEl.value.style.setProperty('--stickyTop', `${childStickyTop.value}px`);
|
||||||
}, {
|
}, {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(childStickyBottom, () => {
|
watch(childStickyBottom, () => {
|
||||||
|
if (bodyEl.value == null) return;
|
||||||
bodyEl.value.style.setProperty('--stickyBottom', `${childStickyBottom.value}px`);
|
bodyEl.value.style.setProperty('--stickyBottom', `${childStickyBottom.value}px`);
|
||||||
}, {
|
}, {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (headerEl.value != null) {
|
||||||
headerEl.value.style.position = 'sticky';
|
headerEl.value.style.position = 'sticky';
|
||||||
headerEl.value.style.top = 'var(--stickyTop, 0)';
|
headerEl.value.style.top = 'var(--stickyTop, 0)';
|
||||||
headerEl.value.style.zIndex = '1000';
|
headerEl.value.style.zIndex = '1000';
|
||||||
|
observer.observe(headerEl.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (footerEl.value != null) {
|
||||||
footerEl.value.style.position = 'sticky';
|
footerEl.value.style.position = 'sticky';
|
||||||
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
|
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
|
||||||
footerEl.value.style.zIndex = '1000';
|
footerEl.value.style.zIndex = '1000';
|
||||||
|
|
||||||
observer.observe(headerEl.value);
|
|
||||||
observer.observe(footerEl.value);
|
observer.observe(footerEl.value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|
Loading…
Reference in New Issue