fix: 🐛 ref

This commit is contained in:
ThatOneCalculator 2022-08-19 14:50:58 -07:00
parent 793fa94c15
commit ec28c5cc73
2 changed files with 9 additions and 10 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "misskey", "name": "misskey",
"version": "12.118.1-calc.10", "version": "12.118.1-calc.10.1",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -25,7 +25,7 @@
<button class="button widget _button" @click="widgetsShowing = true"><i class="fas fa-layer-group"></i></button> <button class="button widget _button" @click="widgetsShowing = true"><i class="fas fa-layer-group"></i></button>
</div> </div>
<button v-if="isMobile && mainRouter.currentRoute.value.name === 'index'" id="postButton" class="postButton button post _button" @click="os.post()"><i class="fas fa-pencil-alt"></i></button> <button v-if="isMobile && mainRouter.currentRoute.value.name === 'index'" ref="postButton" class="postButton button post _button" @click="os.post()"><i class="fas fa-pencil-alt"></i></button>
<transition :name="$store.state.animation ? 'menuDrawer-back' : ''"> <transition :name="$store.state.animation ? 'menuDrawer-back' : ''">
<div <div
@ -89,6 +89,7 @@ window.addEventListener('resize', () => {
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>(); let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
const widgetsEl = $ref<HTMLElement>(); const widgetsEl = $ref<HTMLElement>();
const postButton = $ref<HTMLElement>();
const widgetsShowing = $ref(false); const widgetsShowing = $ref(false);
provide('router', mainRouter); provide('router', mainRouter);
@ -134,17 +135,15 @@ onMounted(() => {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true; if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
let scrollPos = 0; let scrollPos = 0;
const postButton = document.getElementById('postButton');
function checkPosition() { function checkPosition() {
let windowY = window.scrollY; let windowY = window.scrollY;
if (postButton != null) { postButton.style.transform = `scale(${windowY < scrollPos ? '1' : '0'})`;
if (windowY < scrollPos) { // if (windowY < scrollPos) {
postButton.style.transform = 'scale(1)'; // postButton.style.transform = 'scale(1)';
} else { // } else {
postButton.style.transform = 'scale(0)'; // postButton.style.transform = 'scale(0)';
} // }
}
scrollPos = windowY; scrollPos = windowY;
} }