mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-03 16:02:08 +00:00
调整滚动到view
This commit is contained in:
parent
6eeeb733e2
commit
b8234adbc2
15
resources/assets/js/functions/common.js
vendored
15
resources/assets/js/functions/common.js
vendored
@ -1045,6 +1045,21 @@
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 按需滚动到View
|
||||
* @param element
|
||||
*/
|
||||
scrollIntoViewIfNeeded(element) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
if (typeof element.scrollIntoViewIfNeeded === "function") {
|
||||
element.scrollIntoViewIfNeeded()
|
||||
} else {
|
||||
$A.scrollToView(element, {block: "nearest", inline: "nearest"})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 等比缩放尺寸
|
||||
* @param width
|
||||
|
||||
@ -1030,10 +1030,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const active = this.$refs.menuProject.querySelector(".active")
|
||||
if (active) {
|
||||
$A.scrollToView(active, {
|
||||
behavior: 'instant',
|
||||
scrollMode: 'if-needed',
|
||||
});
|
||||
$A.scrollIntoViewIfNeeded(active);
|
||||
}
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
|
||||
@ -385,7 +385,7 @@ export default {
|
||||
} else if (!this.$isDesktop) {
|
||||
this.timerScroll = setInterval(() => {
|
||||
if (this.quill?.hasFocus()) {
|
||||
this.$refs.editor.scrollIntoViewIfNeeded();
|
||||
$A.scrollIntoViewIfNeeded(this.$refs.editor);
|
||||
} else {
|
||||
clearInterval(this.timerScroll);
|
||||
}
|
||||
|
||||
@ -10,7 +10,10 @@
|
||||
<div
|
||||
class="dialog-content"
|
||||
:class="contentClass"
|
||||
v-longpress="handleLongpress">
|
||||
v-longpress="{
|
||||
delay: 300,
|
||||
callback: handleLongpress
|
||||
}">
|
||||
<!--文本-->
|
||||
<div v-if="msgData.type === 'text'" class="content-text no-dark-content">
|
||||
<pre @click="viewText" v-html="textMsg(msgData.msg.text)"></pre>
|
||||
|
||||
@ -382,10 +382,7 @@ export default {
|
||||
// 再次点击滚动到未读条目
|
||||
const dialog = this.dialogList.find(dialog => $A.getDialogUnread(dialog) > 0)
|
||||
if (dialog) {
|
||||
$A.scrollToView(this.$refs[`dialog_${dialog.id}`][0], {
|
||||
behavior: 'smooth',
|
||||
scrollMode: 'if-needed',
|
||||
})
|
||||
$A.scrollIntoViewIfNeeded(this.$refs[`dialog_${dialog.id}`][0])
|
||||
}
|
||||
}
|
||||
this.dialogActive = type
|
||||
@ -517,10 +514,7 @@ export default {
|
||||
if (this.$isDesktop && this.$refs.list) {
|
||||
const active = this.$refs.list.querySelector(".active")
|
||||
if (active) {
|
||||
$A.scrollToView(active, {
|
||||
behavior: 'instant',
|
||||
scrollMode: 'if-needed',
|
||||
});
|
||||
$A.scrollIntoViewIfNeeded(active);
|
||||
} else {
|
||||
const dialog = this.cacheDialogs.find(({id}) => id == this.dialogId)
|
||||
if (dialog && this.dialogActive) {
|
||||
@ -528,10 +522,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const active = this.$refs.list.querySelector(".active")
|
||||
if (active) {
|
||||
$A.scrollToView(active, {
|
||||
behavior: 'instant',
|
||||
scrollMode: 'if-needed',
|
||||
});
|
||||
$A.scrollIntoViewIfNeeded(active);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user