Skip to content

Commit

Permalink
feat(editor): 可选组件按钮只有在可选组件长度大于3时才显示
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Dec 8, 2023
1 parent 741140f commit e50e332
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<TMagicTooltip v-if="page" content="点击查看当前位置下的组件">
<TMagicTooltip v-if="page && buttonVisible" content="点击查看当前位置下的组件">
<div ref="button" class="m-editor-stage-float-button" @click="visible = true">可选组件</div>
</TMagicTooltip>
<FloatingBox
v-if="page && nodeStatusMap"
v-if="page && nodeStatusMap && buttonVisible"
ref="box"
v-model:visible="visible"
title="当前位置下的组件"
Expand Down Expand Up @@ -36,6 +36,7 @@ const services = inject<Services>('services');
const editorService = services?.editorService;
const visible = ref(false);
const buttonVisible = ref(false);
const button = ref<HTMLDivElement>();
const box = ref<InstanceType<typeof FloatingBox>>();
Expand All @@ -58,6 +59,9 @@ const unWatch = watch(
stage.on('select', (el: HTMLElement, event: MouseEvent) => {
const els = stage.renderer.getElementsFromPoint(event) || [];
const ids = els.map((el) => el.id).filter((id) => Boolean(id));
buttonVisible.value = ids.length > 3;
filterTextChangeHandler(ids);
});
Expand Down

0 comments on commit e50e332

Please sign in to comment.