Data-toggle tab does not download Leaflet map

后端 未结 4 1793
抹茶落季
抹茶落季 2020-11-22 09:48

I am using tabs to display clear content, but one of them stopped downloading well since it is in the data-toggle tab. It is a Leaflet map. Here is the code :


4条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 10:03

    For those like me weren't able to solve the challenge with the precious @ghybs explanation (map.invalidateSize()) and were able to do it with @gangai-johann one, there's still a chance you may do it the right way. Put your invalidate instruction inside a setTimeout, as it may be too early to dispatch that instruction.

    setTimeout(() => {
        this.$refs.mymap.mapObject.invalidateSize()
    }, 100)
    

    Refer to https://stackoverflow.com/a/56364130/4537054 answer for detailed instructions.

提交回复
热议问题