|
@@ -13,7 +13,7 @@ export default defineComponent({
|
|
|
},
|
|
|
setup(props, { emit }) {
|
|
|
const data = reactive({
|
|
|
- guidePos: 'bottom' as 'bottom' | 'left' | 'right'
|
|
|
+ guidePos: 'bottom' as 'bottom' | 'left' | 'right' | 'middle'
|
|
|
});
|
|
|
|
|
|
const initGuidePos = () => {
|
|
@@ -29,13 +29,24 @@ export default defineComponent({
|
|
|
?.getBoundingClientRect();
|
|
|
const dragTop = dragBBox?.top || 0;
|
|
|
const dragLeft = dragBBox?.left || 0;
|
|
|
+ const dragRight = dragBBox?.right || 0;
|
|
|
+ // console.log(dragTop, dragBBox, pageHeight, guideHeight);
|
|
|
// 引导页出现在下边
|
|
|
if (pageHeight - dragTop > guideHeight) {
|
|
|
data.guidePos = 'bottom';
|
|
|
} else {
|
|
|
// 引导页出现在左边or右边
|
|
|
- data.guidePos = dragLeft > guideWidth ? 'left' : 'right';
|
|
|
+ if (dragLeft > guideWidth) {
|
|
|
+ data.guidePos = 'left';
|
|
|
+ } else if (pageWidth - dragRight > guideWidth) {
|
|
|
+ data.guidePos = 'right';
|
|
|
+ } else {
|
|
|
+ data.guidePos = 'middle';
|
|
|
+ }
|
|
|
+ // data.guidePos = dragLeft > guideWidth ? 'left' : 'right';
|
|
|
}
|
|
|
+ data.guidePos = 'middle';
|
|
|
+ // console.log(data.guidePos, '121212');
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
setTimeout(() => {
|
|
@@ -54,6 +65,7 @@ export default defineComponent({
|
|
|
styles.guide,
|
|
|
data.guidePos === 'left' && styles.guideLeft,
|
|
|
data.guidePos === 'right' && styles.guideRight,
|
|
|
+ data.guidePos === 'middle' && styles.guidemiddle,
|
|
|
'bom_guide'
|
|
|
]}
|
|
|
onClick={() => emit('guideDone')}>
|