Skip to content

Commit

Permalink
fix: 修复插槽内容一闪而过问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yue1123 committed Nov 22, 2022
1 parent 7549d6e commit 6e1d9f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions packages/components/control/copyright/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<template>
<div ref="copyrightContainer" style="display: none">
<slot></slot>
<div style="display: none">
<div ref="copyrightContainer" v-bind="attrs">
<slot></slot>
</div>
</div>
</template>

<script setup lang="ts">
import { defineProps, withDefaults, defineEmits, onMounted, ref, getCurrentInstance, onUpdated } from 'vue'
import { defineProps, withDefaults, defineEmits, onMounted, ref, getCurrentInstance, onUpdated, useAttrs } from 'vue'
import useBaseMapEffect from '../../../hooks/useBaseMapEffect'
import useLifeCycle from '../../../hooks/useLifeCycle'
import copyrightControlPosCacheMap from './copyrightControlPosCacheMap'
Expand All @@ -30,7 +32,7 @@
const copyrightContainer = ref<HTMLDivElement>()
let copyrightControl: BMapGL.CopyrightControl
const uid = getCurrentInstance()?.uid
const attrs = useAttrs()
defineEmits(['initd', 'unload'])
onMounted(() => {
const { anchor, offset } = props
Expand Down Expand Up @@ -80,6 +82,7 @@
</script>
<script lang="ts">
export default {
name: 'BCopyright'
name: 'BCopyright',
inheritAttrs: false
}
</script>
9 changes: 6 additions & 3 deletions packages/components/overlay/infowindow/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<template>
<div ref="infoWindowContainer" style="display: none">
<slot></slot>
<div style="display: none">
<div ref="infoWindowContainer" v-bind="attrs">
<slot></slot>
</div>
</div>
</template>

<script setup lang="ts">
import { ref, watch, withDefaults, onUpdated, nextTick, computed, provide } from 'vue'
import { ref, watch, withDefaults, onUpdated, nextTick, computed, provide, useAttrs } from 'vue'
import useBaseMapEffect from '../../../hooks/useBaseMapEffect'
import bindEvents, { Callback } from '../../../utils/bindEvents'
import useLifeCycle from '../../../hooks/useLifeCycle'
Expand Down Expand Up @@ -84,6 +86,7 @@
const { ready } = useLifeCycle()
let infoWindow: BMapGL.InfoWindow
let _map: BMapGL.Map
const attrs = useAttrs()
useBaseMapEffect((map: BMapGL.Map) => {
_map = map
const cal = () => {
Expand Down

0 comments on commit 6e1d9f9

Please sign in to comment.