### Install VueVectorMap Package
Source: https://github.com/themustafaomar/vuevectormap/blob/next/README.md
Installs the VueVectorMap package using npm, pnpm, or yarn. Ensure you are using the correct version (`@next` for Vue 3.x).
```bash
npm i vuevectormap@next # pnpm add vuevectormap || yarn add vuevectormap
```
--------------------------------
### Install VueVectorMap Plugin and Global Configuration (JavaScript)
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Installs the vuevectormap plugin in a Vue 3 application with optional global configuration. This configuration applies to all map instances created within the application. It requires importing the plugin, the necessary CSS, and the specific map data.
```javascript
import { createApp } from 'vue'
import vueVectorMap from 'vuevectormap'
import 'vuevectormap/src/scss/vuevectormap.scss'
import 'jsvectormap/dist/maps/world'
const app = createApp({
// Your root component
})
// Install with global options
app.use(vueVectorMap, {
backgroundColor: '#f6f6f6',
// Any other global jsvectormap options
})
app.mount('#app')
```
--------------------------------
### Loading Different Maps in VueVectorMap
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Demonstrates how to load and display various geographical maps using VueVectorMap. It shows examples for world, US, and European maps by importing the corresponding map files from the `jsvectormap/dist/maps/` directory.
```vue
```
--------------------------------
### Map with Lines Between Markers (Vue)
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Connects markers with animated lines to visualize relationships or routes between locations. This example defines markers and then specifies pairs of markers to connect using the 'lines' and 'lineStyle' options. It utilizes the 'world_merc' map.
```vue
```
--------------------------------
### Map with Markers and Labels (Vue)
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Displays markers on specific geographical coordinates with custom styling and labels. This example uses the 'world_merc' map and defines marker positions, colors, and how labels should be rendered. It requires importing the specific map data.
```vue
```
--------------------------------
### Event Handling in VueVectorMap (Vue)
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Attaches event listeners to map interactions using Vue's standard event binding syntax. This example demonstrates handling 'loaded', 'regionTooltipShow', and 'regionClick' events. It includes functions to log event data and handle map resizing for responsiveness.
```vue
```
--------------------------------
### Customize VueVectorMap SCSS Styles
Source: https://github.com/themustafaomar/vuevectormap/blob/next/README.md
Provides an example of how to override default SCSS variables for VueVectorMap when using Sass. This allows for detailed customization of elements like tooltips by importing `jsvectormap` after defining custom variables.
```scss
// Example variables.
$tooltip-bg-color: #3a3d4c;
$tooltip-font-family: Roboto, Etc;
@import 'jsvectormap';
```
--------------------------------
### Initialize VueVectorMap in Vue App
Source: https://github.com/themustafaomar/vuevectormap/blob/next/README.md
Demonstrates how to import and globally configure VueVectorMap in a Vue 3 application. It includes importing the component, its SCSS styles, and a specific map. Global options like `backgroundColor` can be set during initialization.
```javascript
import { createApp } from 'vue'
import vueVectorMap from 'vuevectormap'
import 'vuevectormap/src/scss/vuevectormap.scss'
import 'jsvectormap/dist/maps/world'
const app = createApp({
//
})
app.use(vueVectorMap, {
// Set global options if any etc..
backgroundColor: '#f6f6f6',
})
app.mount('#app')
```
--------------------------------
### Basic Map Component Usage (Vue)
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Renders a simple world map with custom dimensions using the vuevectormap component. Minimal configuration is required, and the map automatically renders on component mount. The component accepts width and height props, along with an options object for map configuration.
```vue
```
--------------------------------
### VueVectorMap Component Props and Configuration
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Details the configuration options for the VueVectorMap component, including `width`, `height`, and the `options` object. The `options` object encompasses various jsvectormap settings like map type, zoom behavior, tooltips, and styles. It also imports a specific map file.
```vue
```
--------------------------------
### Basic VueVectorMap Component Usage
Source: https://github.com/themustafaomar/vuevectormap/blob/next/README.md
Shows how to use the VueVectorMap component within a Vue template. It requires setting `width` and `height` attributes and can accept a `:options` prop for map-specific configurations like markers and styles.
```vue
```
--------------------------------
### SCSS Customization for jsvectormap
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Shows how to customize jsvectormap styles using SCSS variables before importing the library's styles. This method allows for global theme adjustments. It defines variables like `$tooltip-bg-color` and then imports `jsvectormap`.
```scss
// Define custom variables
$tooltip-bg-color: #3a3d4c;
$tooltip-font-family: 'Roboto', sans-serif;
$tooltip-font-size: 14px;
$tooltip-border-radius: 4px;
$tooltip-padding: 8px 12px;
// Import the library styles
@import 'jsvectormap';
```
--------------------------------
### Access Map Instance with Vue Template Refs
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Demonstrates how to access the underlying jsvectormap instance using template refs in Vue. This allows for programmatic control and calling API methods on the map after the component has mounted. It shows accessing the instance via `mapRef.value.map`.
```vue
```
--------------------------------
### Custom Region Styling in VueVectorMap
Source: https://context7.com/themustafaomar/vuevectormap/llms.txt
Illustrates how to apply custom styles to map regions in VueVectorMap. It covers styling for initial, hover, and selected states, as well as defining selected regions. The `regionStyle` object within the `options` prop is used for this purpose.
```vue
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.