mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-15 01:33:54 +00:00
still making progress on refactors
This commit is contained in:
parent
ce71a79b39
commit
f96569a758
@ -31,6 +31,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import * as $ from "jquery";
|
||||||
import { ref, watch, onMounted, defineComponent } from "vue";
|
import { ref, watch, onMounted, defineComponent } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
@ -38,8 +39,14 @@ import { useDashboardStore } from "@/store/modules/dashboard";
|
|||||||
import Configuration from "../views/dashboard/configuration";
|
import Configuration from "../views/dashboard/configuration";
|
||||||
import controls from "../views/dashboard/controls/index";
|
import controls from "../views/dashboard/controls/index";
|
||||||
|
|
||||||
|
interface Item {
|
||||||
|
id: string,
|
||||||
|
index: number,
|
||||||
|
viewOffset: number
|
||||||
|
|
||||||
|
}
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Dashboard",
|
name: "FullView",
|
||||||
props: {
|
props: {
|
||||||
items: {
|
items: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@ -51,9 +58,10 @@ export default defineComponent({
|
|||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const p = useRoute().params;
|
const p = useRoute().params;
|
||||||
const currentItem = ref("");
|
const arrayOfItems = ref<Item[]>([])
|
||||||
|
const currentItem = ref<number>(0);
|
||||||
const scrollWrapRef = ref<any>(null);
|
const scrollWrapRef = ref<any>(null);
|
||||||
const isScrolling = ref(false)
|
const isScrolling = ref(false);
|
||||||
watch(
|
watch(
|
||||||
() => dashboardStore.layout,
|
() => dashboardStore.layout,
|
||||||
() => {
|
() => {
|
||||||
@ -69,29 +77,51 @@ export default defineComponent({
|
|||||||
const observer = new IntersectionObserver((entries) => {
|
const observer = new IntersectionObserver((entries) => {
|
||||||
entries.forEach((element) => {
|
entries.forEach((element) => {
|
||||||
if (element.intersectionRatio > 0) {
|
if (element.intersectionRatio > 0) {
|
||||||
currentItem.value = element.target.id;
|
// currentItem.value = element.target.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document.querySelectorAll(".item").forEach((element) => {
|
document.querySelectorAll(".item").forEach((element,index) => {
|
||||||
|
arrayOfItems.value.push({
|
||||||
|
id: element.id,
|
||||||
|
index: index,
|
||||||
|
viewOffset: element?.offsetTop
|
||||||
|
})
|
||||||
observer.observe(element);
|
observer.observe(element);
|
||||||
});
|
});
|
||||||
|
console.log(arrayOfItems.value[0])
|
||||||
|
document.getElementById(`${arrayOfItems.value[0]}`)?.scrollIntoView()
|
||||||
|
}
|
||||||
|
function scrollUp(){
|
||||||
|
console.log("scrollUP")
|
||||||
}
|
}
|
||||||
function initScroller() {
|
function initScroller() {
|
||||||
scrollWrapRef?.value?.addEventListener("scroll", (e: Event) => {
|
scrollWrapRef?.value?.addEventListener("wheel", (e: WheelEvent) => {
|
||||||
const isBottom =
|
console.log(isScrolling.value === false, e?.deltaY );
|
||||||
scrollWrapRef?.value?.offsetHeight + scrollWrapRef?.value?.scrollTop + 40 >
|
if (isScrolling.value === false) {
|
||||||
scrollWrapRef?.value?.scrollHeight;
|
isScrolling.value = true;
|
||||||
|
if (e.deltaY < 0) {
|
||||||
if (isBottom) {
|
scrollUp()
|
||||||
scrollWrapRef?.value.scroll(0, 0);
|
// scrollUp
|
||||||
|
} else {
|
||||||
|
// scrollDown
|
||||||
|
console.log("Scroll Down")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// const isBottom =
|
||||||
|
// scrollWrapRef?.value?.offsetHeight + scrollWrapRef?.value?.scrollTop + 40 >
|
||||||
|
// scrollWrapRef?.value?.scrollHeight;
|
||||||
|
|
||||||
|
// if (isBottom) {
|
||||||
|
// scrollWrapRef?.value.scroll(0, 0);
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
observeItems();
|
observeItems();
|
||||||
initScroller();
|
initScroller();
|
||||||
console.log(scrollWrapRef.value)
|
console.log(arrayOfItems.value);
|
||||||
|
window.arrayOfItems = arrayOfItems.value
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
t,
|
t,
|
||||||
|
Loading…
Reference in New Issue
Block a user