File tree Expand file tree Collapse file tree 9 files changed +64
-18
lines changed Expand file tree Collapse file tree 9 files changed +64
-18
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ import nav from './nav'
1010import sidebar from './sidebar'
1111
1212export default defineConfig ( {
13- title : ' ' ,
14- description : 'coding-playground是一个vitepress的起始模板 ' ,
13+ title : 'Coding Playground ' ,
14+ description : 'Coding Playground 是一个代码案例集合库,用于存放各种实用的代码示例和最佳实践。 ' ,
1515 base : '/coding-playground' ,
1616 lastUpdated : true ,
1717 head : [
1818 [
1919 'link' ,
2020 {
2121 rel : 'icon' ,
22- href : './vue-icon .svg' ,
22+ href : 'https://cn.vuejs.org/logo .svg' ,
2323 } ,
2424 ] ,
2525 [
@@ -31,7 +31,7 @@ export default defineConfig({
3131 ] ,
3232 ] ,
3333 themeConfig : {
34- logo : '/logo.svg' ,
34+ // logo: '/logo.svg',
3535 nav,
3636 sidebar,
3737 socialLinks : [ { icon : 'github' , link : 'https://github.com/coderhyh/coding-playground' } ] ,
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export default <DefaultTheme.Sidebar>[
1919 { text : 'Mapbox入门' , link : '/packages/gis/mapbox/getting-started' } ,
2020 { text : '点击飞行效果' , link : '/packages/gis/mapbox/fly-to' } ,
2121 { text : '地球自转效果' , link : '/packages/gis/mapbox/rotation' } ,
22+ { text : '添加图片' , link : '/packages/gis/mapbox/add-img' } ,
2223 ] ,
2324 } ,
2425]
Original file line number Diff line number Diff line change 11---
2- title : coding-playground入手指南
3- titleTemplate : vitepress的起始模板
2+ title : Coding Playground
3+ titleTemplate : coding-playground
44---
55
6- # coding-playground
6+ # Coding Playground
77
8- coding-playground是一个vitepress的起始模板
9-
10- ## ✨ 特性
11-
12- - 🏄🏼♂️ 结构简洁实用
8+ 这是一个代码案例集合库,用于存放各种实用的代码示例和最佳实践。
Original file line number Diff line number Diff line change 1919 "node" : " >=18.18.2"
2020 },
2121 "scripts" : {
22- "build" : " npm run clean && vue-tsc --noEmit && vite build" ,
2322 "lint" : " eslint packages/ --fix" ,
24- "docs: dev" : " vitepress dev" ,
25- "docs: build" : " vitepress build" ,
26- "docs: preview" : " vitepress preview" ,
23+ "dev" : " vitepress dev" ,
24+ "build" : " vitepress build" ,
25+ "preview" : " vitepress preview" ,
2726 "postinstall" : " npx simple-git-hooks"
2827 },
2928 "dependencies" : {
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" h-500px" >
3+ <div ref =" mapRef" class =" h-100% w-100%" />
4+ </div >
5+ </template >
6+
7+ <script setup lang="ts">
8+ import mapboxgl from ' mapbox-gl'
9+ import { MapboxEnum } from ' ~/enums/mapbox'
10+
11+ mapboxgl .accessToken = MapboxEnum .ACCESS_TOKEN
12+ const mapRef = ref <HTMLDivElement >()
13+ const map = ref <mapboxgl .Map >()
14+
15+ onMounted (() => {
16+ map .value = new mapboxgl .Map ({
17+ container: mapRef .value ! ,
18+ style: ' mapbox://styles/mapbox/standard' ,
19+ center: [120.153576 , 30.287459 ],
20+ projection: ' globe' ,
21+ zoom: 1 ,
22+ })
23+
24+ map .value .on (' style.load' , () => {
25+ map .value ?.addSource (' image' , {
26+ type: ' image' ,
27+ url: ' /coding-playground/avatar.jpg' ,
28+ coordinates: [
29+ [120.153576 , 30.287459 ],
30+ [120.153576 + 10 , 30.287459 ],
31+ [120.153576 + 10 , 30.287459 + 10 ],
32+ [120.153576 , 30.287459 + 10 ],
33+ ],
34+ })
35+
36+ map .value ?.addLayer ({
37+ id: ' image' ,
38+ source: ' image' ,
39+ type: ' raster' ,
40+ })
41+ })
42+ })
43+ </script >
Original file line number Diff line number Diff line change 1+ # 添加图片
2+
3+ :::preview 说明 || Mapbox 添加图片
4+
5+ demo-preview=./demo.vue
6+
7+ :::
Original file line number Diff line number Diff line change 11<template >
22 <div class =" relative h-500px" >
3- <div class =" absolute left-5px top-5px z-999 w200px" >
3+ <div class =" absolute left-5px top-5px z-1 w200px" >
44 <el-button type =" primary" @click =" flyTo([121.5, 31.23])" >
55 To 上海
66 </el-button >
Original file line number Diff line number Diff line change 11<template >
22 <div class =" relative h-500px" >
3- <div class =" absolute left-5px top-5px z-999 w200px" >
3+ <div class =" absolute left-5px top-5px z-1 w200px" >
44 <el-select v-model =" mapStyle" placeholder =" Select Map Style" size =" small" @change =" changeMapStyle" >
55 <el-option label =" 标准" value =" standard" />
66 <el-option label =" 街道" value =" streets-v12" />
You can’t perform that action at this time.
0 commit comments