|
@@ -12,12 +12,23 @@ export default defineComponent({
|
|
const initGuidePos = () => {
|
|
const initGuidePos = () => {
|
|
const pageHeight =
|
|
const pageHeight =
|
|
document.documentElement.clientHeight || document.body.clientHeight;
|
|
document.documentElement.clientHeight || document.body.clientHeight;
|
|
|
|
+ const pageWidth =
|
|
|
|
+ document.documentElement.clientWidth || document.body.clientWidth;
|
|
const guideHeight =
|
|
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';
|
|
|
|
|
|
+ document.querySelector('.bom_guide')?.clientHeight || 0;
|
|
|
|
+ const guideWidth = document.querySelector('.bom_guide')?.clientWidth || 0;
|
|
|
|
+ const dragBBox = document
|
|
|
|
+ .querySelector('.bom_drag')
|
|
|
|
+ ?.getBoundingClientRect();
|
|
|
|
+ const dragTop = dragBBox?.top || 0;
|
|
|
|
+ const dragLeft = dragBBox?.left || 0;
|
|
|
|
+ // 引导页出现在下边
|
|
|
|
+ if (pageHeight - dragTop > guideHeight) {
|
|
|
|
+ data.guidePos = 'bottom';
|
|
|
|
+ } else {
|
|
|
|
+ // 引导页出现在左边or右边
|
|
|
|
+ data.guidePos = dragLeft > guideWidth ? 'left' : 'right';
|
|
|
|
+ }
|
|
};
|
|
};
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
if (guidanceShow.value) {
|
|
if (guidanceShow.value) {
|
|
@@ -39,7 +50,8 @@ export default defineComponent({
|
|
onClick={setGuidanceShow}
|
|
onClick={setGuidanceShow}
|
|
class={[
|
|
class={[
|
|
styles.guide,
|
|
styles.guide,
|
|
- data.guidePos === 'top' && styles.guideTop,
|
|
|
|
|
|
+ data.guidePos === 'left' && styles.guideLeft,
|
|
|
|
+ data.guidePos === 'right' && styles.guideRight,
|
|
!guidanceShowDela.value && styles.hideGuide,
|
|
!guidanceShowDela.value && styles.hideGuide,
|
|
'bom_guide'
|
|
'bom_guide'
|
|
]}>
|
|
]}>
|