mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 20:43:09 +02:00
nextTick?
This commit is contained in:
parent
cb63a1ed00
commit
0079f3394b
1 changed files with 6 additions and 4 deletions
|
@ -251,7 +251,11 @@ function preventDefault(ev: Event) {
|
|||
* ChromeやFirefoxはこれをいい感じにやってくれるが、Safariはやってくれないため自分で実装する必要がある
|
||||
* @param fn DOM操作(unshiftItemsなどで)
|
||||
*/
|
||||
function adjustScroll(fn: () => void): Promise<void> {
|
||||
async function adjustScroll(fn: () => void): Promise<void> {
|
||||
denyMoveTransition.value = true;
|
||||
|
||||
await nextTick();
|
||||
|
||||
const oldHeight = scrollableElement ? scrollableElement.scrollHeight : getBodyScrollHeight();
|
||||
const oldScroll = scrollableElement ? scrollableElement.scrollTop : window.scrollY;
|
||||
// スクロールをやめさせる
|
||||
|
@ -265,11 +269,9 @@ function adjustScroll(fn: () => void): Promise<void> {
|
|||
console.error(err, { scrollableElementOrHtml });
|
||||
}
|
||||
|
||||
denyMoveTransition.value = true;
|
||||
|
||||
fn();
|
||||
|
||||
return nextTick(() => {
|
||||
return await nextTick(() => {
|
||||
try {
|
||||
// scrollByで移動すればいいように思うがうまくいかない、なぜ??
|
||||
const top = oldScroll + ((scrollableElement ? scrollableElement.scrollHeight : getBodyScrollHeight()) - oldHeight);
|
||||
|
|
Loading…
Reference in a new issue