初始化
This commit is contained in:
80
src/components/MapContainer.vue
Normal file
80
src/components/MapContainer.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { ExternalLink } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '公司位置'
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
mapUrl: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
openUrl: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const resolvedMapUrl = computed(() => (
|
||||||
|
props.mapUrl || `https://www.amap.com/search?query=${encodeURIComponent(props.query || props.title)}`
|
||||||
|
))
|
||||||
|
|
||||||
|
const resolvedOpenUrl = computed(() => props.openUrl || resolvedMapUrl.value)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="map-container">
|
||||||
|
<iframe
|
||||||
|
:src="resolvedMapUrl"
|
||||||
|
:title="`${title} 高德地图`"
|
||||||
|
loading="lazy"
|
||||||
|
referrerpolicy="no-referrer-when-downgrade"
|
||||||
|
/>
|
||||||
|
<a :href="resolvedOpenUrl" target="_blank" rel="noreferrer" class="map-container-link">
|
||||||
|
<ExternalLink :size="15" aria-hidden="true" />
|
||||||
|
在高德地图中打开
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.map-container {
|
||||||
|
background: rgba(255, 255, 255, 0.02);
|
||||||
|
height: 100%;
|
||||||
|
min-height: inherit;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-container iframe {
|
||||||
|
border: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: inherit;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-container-link {
|
||||||
|
align-items: center;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
background: rgba(8, 15, 17, 0.72);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.16);
|
||||||
|
border-radius: 999px;
|
||||||
|
bottom: 0.85rem;
|
||||||
|
color: #f8ffff;
|
||||||
|
display: inline-flex;
|
||||||
|
font-size: 0.86rem;
|
||||||
|
font-weight: 900;
|
||||||
|
gap: 0.4rem;
|
||||||
|
min-height: 38px;
|
||||||
|
padding: 0.55rem 0.78rem;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.85rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,6 +3,7 @@ import { ArrowRight, Building2, CheckCircle2, MapPinned, ShieldCheck, Sparkles }
|
|||||||
import AnimatedContent from '@/components/vue-bits/AnimatedContent.vue'
|
import AnimatedContent from '@/components/vue-bits/AnimatedContent.vue'
|
||||||
import DecryptedText from '@/components/vue-bits/DecryptedText.vue'
|
import DecryptedText from '@/components/vue-bits/DecryptedText.vue'
|
||||||
import SplitText from '@/components/vue-bits/SplitText.vue'
|
import SplitText from '@/components/vue-bits/SplitText.vue'
|
||||||
|
import MapContainer from '@/components/MapContainer.vue'
|
||||||
import { siteConfig } from '@/site.config'
|
import { siteConfig } from '@/site.config'
|
||||||
|
|
||||||
const principleIcons = [Sparkles, CheckCircle2, ShieldCheck, Building2]
|
const principleIcons = [Sparkles, CheckCircle2, ShieldCheck, Building2]
|
||||||
@@ -100,11 +101,11 @@ const principleIcons = [Sparkles, CheckCircle2, ShieldCheck, Building2]
|
|||||||
|
|
||||||
<AnimatedContent :distance="48" direction="horizontal" :reverse="true" :duration="0.86" class-name="about-map-panel">
|
<AnimatedContent :distance="48" direction="horizontal" :reverse="true" :duration="0.86" class-name="about-map-panel">
|
||||||
<div class="about-map-frame">
|
<div class="about-map-frame">
|
||||||
<iframe
|
<MapContainer
|
||||||
:src="siteConfig.about.mapUrl"
|
:title="siteConfig.about.locationName"
|
||||||
:title="`${siteConfig.about.locationName} 高德地图`"
|
:query="siteConfig.about.mapQuery"
|
||||||
loading="lazy"
|
:map-url="siteConfig.about.mapUrl"
|
||||||
referrerpolicy="no-referrer-when-downgrade"
|
:open-url="siteConfig.about.mapOpenUrl"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="about-map-meta">
|
<div class="about-map-meta">
|
||||||
|
|||||||
Reference in New Issue
Block a user