ImageApngLoader
Provide preloaded APNG icons
Example
Example Source Code
vue
<template>
<div style="height: 400px" class="vw-full vh-full">
<mb-map :center="[115.124368, 29.216049]" :zoom="10">
<mb-tianditu-layer :types="tiandituTypes" />
<mb-image-apng-loader :images="images" />
<mb-symbol-layer
id="symbol"
:data="symbolDataSource"
:icon-size="0.2"
icon-image-field="icon"
icon-rotation-alignment="map"
/>
</mb-map>
</div>
</template>
<script setup lang="ts">
const tiandituTypes = ['vec', 'cia']
const images = [
{
name: 'firefox',
url: `${__RESOURCE_URL__}images/firefox.png`,
},
]
const symbolDataSource = [
{
coordinates: [115.124368, 29.216049],
properties: {
icon: 'firefox',
},
},
{
coordinates: [115.124368, 29.246049],
properties: {
icon: 'firefox',
},
},
{
coordinates: [115.124368, 29.186049],
properties: {
icon: 'firefox',
},
},
{
coordinates: [115.324368, 29.216049],
properties: {
icon: 'firefox',
},
},
]
</script>
API
PROPS
Name | Description | Type | Default |
---|---|---|---|
images | An array of image properties. Each object in the array must include a required name property and image-related information | Array<{ name: string; url: string; size?: number[]; requestInit?: RequestInit }> | - |
This component uses fetch to request image data. If the request is cross-origin, please configure CORS headers on the server side. requestInit refers to the second parameter of the fetch function.
EVENTS
Name | Description | Parameters |
---|---|---|
created | Map initialization completed event | - |
SLOTS
Name | Description |
---|
METHODS
Name | Description | Definition |
---|