mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-30 03:36:44 -06:00
15 lines
522 B
TypeScript
15 lines
522 B
TypeScript
import { Directive } from 'vue';
|
|
|
|
export default {
|
|
mounted(src, binding, vn) {
|
|
//const query = binding.value;
|
|
|
|
const header = src.children[0];
|
|
const currentStickyTop = getComputedStyle(src).getPropertyValue('--stickyTop') || '0px';
|
|
src.style.setProperty('--stickyTop', `calc(${currentStickyTop} + ${header.offsetHeight}px)`);
|
|
header.style.setProperty('--stickyTop', currentStickyTop);
|
|
header.style.position = 'sticky';
|
|
header.style.top = 'var(--stickyTop)';
|
|
header.style.zIndex = '1';
|
|
},
|
|
} as Directive;
|