App.vue
<template>
<div id="app">
<AppMap/>
</div>
</template>
<script>
import AppMap from './components/AppMap'
export default {
name: 'App',
components: {
AppMap
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Компонент с картой:
<template>
<div class="AppMap" id="AppMap">
<h1>{{msg}}</h1>
</div>
</template>
<script>
const mymap = L.map('AppMap').setView([55.75222, 37.61556], 13);
const attribution = '© <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors';
const tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const tiles = L.tileLayer (tileUrl, {attribution});
tiles.addTo (mymap)
export default {
name: 'AppMap',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#AppMap {
height: 500px;
width: 800px;
}
</style>
Консоль выдает ошибку "Map container is not found". Помогите решить проблему