|
@@ -1,14 +1,52 @@
|
|
|
-import { defineComponent } from 'vue';
|
|
|
+import { defineComponent, reactive, onMounted, ref } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
+import { setGuidanceShow, guidanceShow } from './useDragGuidance';
|
|
|
// 底部拖动区域
|
|
|
export default defineComponent({
|
|
|
name: 'dragBom',
|
|
|
setup() {
|
|
|
+ const data = reactive({
|
|
|
+ guidePos: 'bottom'
|
|
|
+ });
|
|
|
+ const guidanceShowDela = ref(false);
|
|
|
+ const initGuidePos = () => {
|
|
|
+ const pageHeight =
|
|
|
+ document.documentElement.clientHeight || document.body.clientHeight;
|
|
|
+ const guideHeight =
|
|
|
+ document.querySelector('.bom_guide')?.getBoundingClientRect().height ||
|
|
|
+ 0;
|
|
|
+ const dragTop =
|
|
|
+ document.querySelector('.bom_drag')?.getBoundingClientRect()?.top || 0;
|
|
|
+ data.guidePos = pageHeight - dragTop < guideHeight ? 'top' : 'bottom';
|
|
|
+ };
|
|
|
+ onMounted(() => {
|
|
|
+ if (guidanceShow.value) {
|
|
|
+ const _itme = setTimeout(() => {
|
|
|
+ clearTimeout(_itme);
|
|
|
+ initGuidePos();
|
|
|
+ guidanceShowDela.value = true;
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
+ });
|
|
|
return () => (
|
|
|
- <div class={[styles.dragBom, 'bom_drag']}>
|
|
|
- <div class={styles.box}></div>
|
|
|
- <div class={styles.box}></div>
|
|
|
- </div>
|
|
|
+ <>
|
|
|
+ <div class={[styles.dragBom, 'bom_drag']}>
|
|
|
+ <div class={styles.box}></div>
|
|
|
+ <div class={styles.box}></div>
|
|
|
+ </div>
|
|
|
+ {guidanceShow.value && (
|
|
|
+ <div
|
|
|
+ class={[
|
|
|
+ styles.guide,
|
|
|
+ data.guidePos === 'top' && styles.guideTop,
|
|
|
+ !guidanceShowDela.value && styles.hideGuide,
|
|
|
+ 'bom_guide'
|
|
|
+ ]}>
|
|
|
+ <div class={styles.guideBg}></div>
|
|
|
+ <div class={styles.guideDone} onClick={setGuidanceShow}></div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
);
|
|
|
}
|
|
|
});
|