mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 添加百度地图插件
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<n-card title="富文本插件" class="shadow-sm rounded-16px">
|
||||
<div ref="domRef" class="dark:bg-dark"></div>
|
||||
<template #footer>
|
||||
<github-link link="https://github.com/wangeditor-team/wangEditor" />
|
||||
</template>
|
||||
</n-card>
|
||||
</div>
|
||||
<div>
|
||||
<n-card title="富文本插件" class="shadow-sm rounded-16px">
|
||||
<div ref="domRef" class="dark:bg-dark"></div>
|
||||
<template #footer>
|
||||
<github-link link="https://github.com/wangeditor-team/wangEditor" />
|
||||
</template>
|
||||
</n-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -19,24 +19,26 @@ const editor = ref<WangEditor | null>(null);
|
||||
const domRef = ref<HTMLElement | null>(null);
|
||||
|
||||
function renderWangEditor() {
|
||||
editor.value = new WangEditor(domRef.value);
|
||||
setEditorConfig();
|
||||
editor.value.create();
|
||||
editor.value = new WangEditor(domRef.value);
|
||||
setEditorConfig();
|
||||
editor.value.create();
|
||||
}
|
||||
|
||||
function setEditorConfig() {
|
||||
editor.value!.config.zIndex = 10;
|
||||
editor.value!.config.zIndex = 10;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
renderWangEditor();
|
||||
renderWangEditor();
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
:deep(.w-e-text-container) {
|
||||
background: inherit;
|
||||
}
|
||||
:deep(.w-e-toolbar) {
|
||||
background: inherit !important;
|
||||
background: inherit !important;
|
||||
border-color: #999 !important;
|
||||
}
|
||||
:deep(.w-e-text-container) {
|
||||
background: inherit;
|
||||
border-color: #999 !important;
|
||||
}
|
||||
</style>
|
||||
|
27
src/views/component/map/components/BaiduMap.vue
Normal file
27
src/views/component/map/components/BaiduMap.vue
Normal file
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div ref="domRef" class="w-full h-full"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, nextTick } from 'vue';
|
||||
import { BAIDU_MAP_SDK_URL } from '@/settings';
|
||||
import { useScript } from '@/hooks';
|
||||
|
||||
const { load } = useScript(BAIDU_MAP_SDK_URL);
|
||||
|
||||
const domRef = ref<HTMLDivElement | null>(null);
|
||||
|
||||
async function renderBaiduMap() {
|
||||
await load();
|
||||
await nextTick();
|
||||
const map = new BMapGL.Map(domRef.value!);
|
||||
const point = new BMapGL.Point(116.404, 39.915);
|
||||
map.centerAndZoom(point, 15);
|
||||
map.enableScrollWheelZoom();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
renderBaiduMap();
|
||||
});
|
||||
</script>
|
||||
<style scoped></style>
|
6
src/views/component/map/components/GaodeMap.vue
Normal file
6
src/views/component/map/components/GaodeMap.vue
Normal file
@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>地图</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
<style scoped></style>
|
6
src/views/component/map/components/TencentMap.vue
Normal file
6
src/views/component/map/components/TencentMap.vue
Normal file
@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>地图</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
<style scoped></style>
|
5
src/views/component/map/components/index.ts
Normal file
5
src/views/component/map/components/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import BaiduMap from './BaiduMap.vue';
|
||||
import GaodeMap from './GaodeMap.vue';
|
||||
import TencentMap from './TencentMap.vue';
|
||||
|
||||
export { BaiduMap, GaodeMap, TencentMap };
|
@ -1,6 +1,30 @@
|
||||
<template>
|
||||
<div>地图</div>
|
||||
<div>
|
||||
<n-card title="地图插件" class="h-full shadow-sm rounded-16px">
|
||||
<n-tabs type="line" class="flex-col-stretch h-full" pane-class="flex-1-hidden">
|
||||
<n-tab-pane v-for="item in maps" :key="item.id" :name="item.id" :tab="item.label">
|
||||
<component :is="item.component" />
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</n-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue';
|
||||
import { NCard, NTabs, NTabPane } from 'naive-ui';
|
||||
import { BaiduMap, GaodeMap, TencentMap } from './components';
|
||||
|
||||
interface Map {
|
||||
id: string;
|
||||
label: string;
|
||||
component: Component;
|
||||
}
|
||||
|
||||
const maps: Map[] = [
|
||||
{ id: 'baidu', label: '百度地图', component: BaiduMap },
|
||||
{ id: 'gaode', label: '高德地图', component: GaodeMap },
|
||||
{ id: 'tencent', label: '腾讯地图', component: TencentMap }
|
||||
];
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
Reference in New Issue
Block a user