Commit 99d62ef9180f29a58b65412a039237eff7f420d3
1 parent
de8cdf9d
perf(src/packages): 优化多个摄像头鼠标移入显示移除隐藏
Showing
1 changed file
with
14 additions
and
3 deletions
| 1 | <template> | 1 | <template> |
| 2 | - <div class="banner-box" ref="root"> | 2 | + <div |
| 3 | + @mouseenter="handleMouseenter" | ||
| 4 | + @mouseleave="handleMouseleave" | ||
| 5 | + class="banner-box" ref="root"> | ||
| 3 | <div class="wrapper"> | 6 | <div class="wrapper"> |
| 4 | <div v-for="(item, index) in option.dataset" :key="index + item" :class="item.className" :style="item.sty"> | 7 | <div v-for="(item, index) in option.dataset" :key="index + item" :class="item.className" :style="item.sty"> |
| 5 | <CameraItem | 8 | <CameraItem |
| @@ -15,8 +18,8 @@ | @@ -15,8 +18,8 @@ | ||
| 15 | <span class="video-title">{{ item.name }}</span> | 18 | <span class="video-title">{{ item.name }}</span> |
| 16 | </div> | 19 | </div> |
| 17 | </div> | 20 | </div> |
| 18 | - <a href="javascript:;" class="left" @click="changeSlide('left')"></a> | ||
| 19 | - <a href="javascript:;" class="right" @click="changeSlide('right')"></a> | 21 | + <a v-show="isShowSvg" href="javascript:;" class="left" @click="changeSlide('left')"></a> |
| 22 | + <a v-show="isShowSvg" href="javascript:;" class="right" @click="changeSlide('right')"></a> | ||
| 20 | </div> | 23 | </div> |
| 21 | </template> | 24 | </template> |
| 22 | <script setup lang="ts" name="index"> | 25 | <script setup lang="ts" name="index"> |
| @@ -33,6 +36,8 @@ const props = defineProps({ | @@ -33,6 +36,8 @@ const props = defineProps({ | ||
| 33 | } | 36 | } |
| 34 | }) | 37 | }) |
| 35 | 38 | ||
| 39 | +const isShowSvg = ref(false) | ||
| 40 | + | ||
| 36 | const { w, h } = toRefs(props.chartConfig.attr) | 41 | const { w, h } = toRefs(props.chartConfig.attr) |
| 37 | 42 | ||
| 38 | const option = shallowReactive({ | 43 | const option = shallowReactive({ |
| @@ -150,6 +155,12 @@ function changeVideo(dir: string) { | @@ -150,6 +155,12 @@ function changeVideo(dir: string) { | ||
| 150 | function changeSlide(dir: string) { | 155 | function changeSlide(dir: string) { |
| 151 | changeVideo(dir) | 156 | changeVideo(dir) |
| 152 | } | 157 | } |
| 158 | + | ||
| 159 | +const handleMouseenter = () => { | ||
| 160 | + isShowSvg.value = true | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +const handleMouseleave = () => (isShowSvg.value = false) | ||
| 153 | </script> | 164 | </script> |
| 154 | 165 | ||
| 155 | <style lang="scss" scoped> | 166 | <style lang="scss" scoped> |