mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 03:03:41 +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
|
* @param width
|
||||||
|
|||||||
@ -1030,10 +1030,7 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const active = this.$refs.menuProject.querySelector(".active")
|
const active = this.$refs.menuProject.querySelector(".active")
|
||||||
if (active) {
|
if (active) {
|
||||||
$A.scrollToView(active, {
|
$A.scrollIntoViewIfNeeded(active);
|
||||||
behavior: 'instant',
|
|
||||||
scrollMode: 'if-needed',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
|
|||||||
@ -385,7 +385,7 @@ export default {
|
|||||||
} else if (!this.$isDesktop) {
|
} else if (!this.$isDesktop) {
|
||||||
this.timerScroll = setInterval(() => {
|
this.timerScroll = setInterval(() => {
|
||||||
if (this.quill?.hasFocus()) {
|
if (this.quill?.hasFocus()) {
|
||||||
this.$refs.editor.scrollIntoViewIfNeeded();
|
$A.scrollIntoViewIfNeeded(this.$refs.editor);
|
||||||
} else {
|
} else {
|
||||||
clearInterval(this.timerScroll);
|
clearInterval(this.timerScroll);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,10 @@
|
|||||||
<div
|
<div
|
||||||
class="dialog-content"
|
class="dialog-content"
|
||||||
:class="contentClass"
|
:class="contentClass"
|
||||||
v-longpress="handleLongpress">
|
v-longpress="{
|
||||||
|
delay: 300,
|
||||||
|
callback: handleLongpress
|
||||||
|
}">
|
||||||
<!--文本-->
|
<!--文本-->
|
||||||
<div v-if="msgData.type === 'text'" class="content-text no-dark-content">
|
<div v-if="msgData.type === 'text'" class="content-text no-dark-content">
|
||||||
<pre @click="viewText" v-html="textMsg(msgData.msg.text)"></pre>
|
<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)
|
const dialog = this.dialogList.find(dialog => $A.getDialogUnread(dialog) > 0)
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
$A.scrollToView(this.$refs[`dialog_${dialog.id}`][0], {
|
$A.scrollIntoViewIfNeeded(this.$refs[`dialog_${dialog.id}`][0])
|
||||||
behavior: 'smooth',
|
|
||||||
scrollMode: 'if-needed',
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dialogActive = type
|
this.dialogActive = type
|
||||||
@ -517,10 +514,7 @@ export default {
|
|||||||
if (this.$isDesktop && this.$refs.list) {
|
if (this.$isDesktop && this.$refs.list) {
|
||||||
const active = this.$refs.list.querySelector(".active")
|
const active = this.$refs.list.querySelector(".active")
|
||||||
if (active) {
|
if (active) {
|
||||||
$A.scrollToView(active, {
|
$A.scrollIntoViewIfNeeded(active);
|
||||||
behavior: 'instant',
|
|
||||||
scrollMode: 'if-needed',
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const dialog = this.cacheDialogs.find(({id}) => id == this.dialogId)
|
const dialog = this.cacheDialogs.find(({id}) => id == this.dialogId)
|
||||||
if (dialog && this.dialogActive) {
|
if (dialog && this.dialogActive) {
|
||||||
@ -528,10 +522,7 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const active = this.$refs.list.querySelector(".active")
|
const active = this.$refs.list.querySelector(".active")
|
||||||
if (active) {
|
if (active) {
|
||||||
$A.scrollToView(active, {
|
$A.scrollIntoViewIfNeeded(active);
|
||||||
behavior: 'instant',
|
|
||||||
scrollMode: 'if-needed',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user