本文介绍了Mapbox GL JS 可视化项目搭建(vue3.0)求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。
对技术面试,学习经验等有一些体会,在此分享。
1、vue cli 安装
$ npm install @vue/cli -g
2、查看版本
$ vue -V @vue/cli 4.5.9
3、新建一个项目
$ vue create mapbox-example
Vue CLI v4.5.9 ? Please pick a preset: Default ([Vue 2] babel, eslint) > Default (Vue 3 Preview) ([Vue 3] babel, eslint) Manually select features
4、安装 vue-router
yarn add vue-router@4.0.0-alpha.6
5、安装 mapbox-gl
yarn add mapbox-gl
6、新建组件 Map.vue
<template> <div id="first-map"></div> </template> <script> import 'mapbox-gl/dist/mapbox-gl.css'; import mapbox from 'mapbox-gl'; export default { name: 'Map', mounted() { mapbox.accessToken = 'YOUR_KEY'; const mapApp = new mapbox.Map({ container: 'first-map', style: 'mapbox://styles/mapbox/streets-v9', center: [120.57229, 31.28505], zoom: 9, }); }, }; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> #first-map { padding: 0%; margin: 0%; width: 100%; height: 100%; overflow: hidden; } </style>
7、配置路由
“`javascript
1、vue cli 安装
$ npm install @vue/cli -g
2、查看版本
$ vue -V @vue/cli 4.5.9
3、新建一个项目
$ vue create mapbox-example
Vue CLI v4.5.9 ? Please pick a preset: Default ([Vue 2] babel, eslint) > Default (Vue 3 Preview) ([Vue 3] babel, eslint) Manually select features
4、安装 vue-router
yarn add vue-router@4.0.0-alpha.6
5、安装 mapbox-gl
yarn add mapbox-gl
6、新建组件 Map.vue
<template> <div id="first-map"></div> </template> <script> import 'mapbox-gl/dist/mapbox-gl.css'; import mapbox from 'mapbox-gl'; export default { name: 'Map', mounted() { mapbox.accessToken = 'YOUR_KEY'; const mapApp = new mapbox.Map({ container: 'first-map', style: 'mapbox://styles/mapbox/streets-v9', center: [120.57229, 31.28505], zoom: 9, }); }, }; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> #first-map { padding: 0%; margin: 0%; width: 100%; height: 100%; overflow: hidden; } </style>
7、配置路由
“`javascript
1、vue cli 安装
$ npm install @vue/cli -g
2、查看版本
$ vue -V @vue/cli 4.5.9
3、新建一个项目
$ vue create mapbox-example
Vue CLI v4.5.9 ? Please pick a preset: Default ([Vue 2] babel, eslint) > Default (Vue 3 Preview) ([Vue 3] babel, eslint) Manually select features
4、安装 vue-router
yarn add vue-router@4.0.0-alpha.6
5、安装 mapbox-gl
yarn add mapbox-gl
6、新建组件 Map.vue
<template> <div id="first-map"></div> </template> <script> import 'mapbox-gl/dist/mapbox-gl.css'; import mapbox from 'mapbox-gl'; export default { name: 'Map', mounted() { mapbox.accessToken = 'YOUR_KEY'; const mapApp = new mapbox.Map({ container: 'first-map', style: 'mapbox://styles/mapbox/streets-v9', center: [120.57229, 31.28505], zoom: 9, }); }, }; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> #first-map { padding: 0%; margin: 0%; width: 100%; height: 100%; overflow: hidden; } </style>
7、配置路由
“`javascript
部分转自互联网,侵权删除联系
最新评论