当前位置: 首页 > wzjs >正文

西宁网站怎么做seo定制型网站建设平台

西宁网站怎么做seo,定制型网站建设平台,淄博网站制作设计高端,朝阳区seo搜索引擎优化介绍1. 使用场景 在开发WebGIS应用时,我们常需要将自定义UI组件与地图元素结合。本文介绍如何将Vue组件集成到Mapbox/Maplibre的Marker标记点和Popup弹窗中,实现动态交互式的地图功能。 2. 为什么需要特殊处理? 在常规开发中我们大多的处理是 …

1. 使用场景

在开发WebGIS应用时,我们常需要将自定义UI组件与地图元素结合。本文介绍如何将Vue组件集成到Mapbox/Maplibre的Marker标记点和Popup弹窗中,实现动态交互式的地图功能。

2. 为什么需要特殊处理?

在常规开发中我们大多的处理是

const tipsEle = document.createElement("div")tipsEle.setAttribute("class", "tips")tipsEle.style.color = "#e73f32"tipsEle.style.fontSize = "12px"tipsEle.style.fontWeight = "400"tipsEle.innerHTML = "删除"const tipsOption = {element: tipsEle,anchor: "left",offset: [-45, 30],}new maplibregl.Marker(tipsOption).setLngLat(coords).addTo(map)

这样的写法显而易见维护难,调试难,ui在复杂一点复杂程度也跟着上去了,如果换成组件形式的话,所有问题迎刃而解了。

3. 使用createVNode实现

/*** @description: 创建地图Marker 和 Popup 组件, 渲染自定义组件* @author: jihai* @createTime: 2025/03/05 15:05:01*/
import {createVNode, render} from "vue";
import * as maplibregl from 'maplibre-gl';class CreateVNode{declare map:anydeclare coordinates:anydeclare markerComponentId: stringdeclare marker:anydeclare markerElement: anydeclare popupComponentId: stringdeclare popup:anydeclare popupElement: anyconstructor(option: {map: any,coordinates: any}) {const {map, coordinates} = optionthis.map = mapthis.coordinates = coordinatesthis.markerComponentId = `markerComponentId-${performance.now().toString()}`this.marker = nullthis.markerElement = nullthis.popupComponentId = `popupComponentId-${performance.now().toString()}`this.popup = nullthis.popupElement = null}createMarker(options: {component: {component: any, // 自定义vue组件props: any      // 自定义组件props},config?: {offset: number[],anchor: string}}){const { component, config } = optionsconst app = createVNode(component?.component, {data: component?.props})this.markerElement = document.createElement("div")this.markerElement.setAttribute("id", this.markerComponentId)this.marker = new maplibregl.Marker({element: this.markerElement,anchor: config?.anchor ?? 'bottom',offset: config?.offset ?? [0, 0]}).setLngLat(this.coordinates).addTo(this.map)render(app, this.markerElement)}createPopup(options: {component: {component: any, // 自定义vue组件props: any      // 自定义vue组件props},config?: {offset: number[],anchor: string,closeButton: boolean}}){const { component, config } = optionsconst app = createVNode(component?.component, {data: component?.props})this.popupElement = document.createElement("div")this.popupElement.setAttribute("id", this.popupComponentId)this.popup = new maplibregl.Popup({className: 'custom-popup', closeButton: config?.closeButton ?? true, anchor: config?.anchor ?? 'bottom'}).setMaxWidth('none').setOffset(config?.offset ?? [0, 0]) // 这里设置偏移量.setLngLat(this.coordinates).setDOMContent(this.popupElement).addTo(this.map)render(app, this.popupElement)}removeMarker(){if(this.marker){this.marker.remove()}if(this.markerElement){this.markerElement.remove()}}removePopup(){if(this.popup){this.popup.remove()}if(this.popupElement){this.popupElement.remove()}}remove(){this.removeMarker()this.removePopup()}
}export default CreateVNode

4. 使用方法

  // 简单使用 具体使用根据业务场景合理清除图层let marker = new CreateVNode({map: map,coordinates: coordinates})marker.createMarker({component: {component: markerComp,props: markerProps},config: {offset: [0, 120],anchor: 'bottom'}})//  图层清除marker.removeMarker()marker = null

5. 效果展示

红色框里为element组件渲染结果
在这里插入图片描述

http://www.dtcms.com/wzjs/832706.html

相关文章:

  • 宁夏网站开发公司深圳公司排名名字
  • 互联网公司 网站wordpress做微信支付
  • 陕西网站开发昆明做网站费用
  • 企业网站建设业务报价单精确定时器 wordpress
  • 网站建设总结与长春网站建设加q479185700
  • 建网站没有公司资质东西湖网站建设公司
  • 网站开发语言和数据库有几种上海php网站建设
  • 淄博网站制作定制改版网页界面设计教材
  • 平凉市建设厅官方网站广州比较好的网站设计
  • 华为做网站吗用什么建网站 cms
  • 常熟专业做网站中国100强企业名单公布
  • 台州做网站哪家好建设赚钱的网站
  • 强的网站建设公网络架构结构
  • 万网站做视频网站的挣钱吗
  • 如何做网站微信小程序什么叫网站降权
  • 百度seo排名优化排行简述seo
  • 镇江品牌网站建设创意网店名
  • 石家庄做网站推广排名的公司wordpress站点转移
  • 天津工程建设信息网站宝塔做网站安全吗
  • 欧美一级a做爰片免费网站一键配置wordpress
  • 网站建设材料汇报厦门seo培训
  • 云霄建设局网站ui设计主要做什么
  • 淄博周村网站建设方案世界建设企业网站
  • vs2017 做c 网站wordpress 吧
  • 我爱建站免费空间怎么做创意短视频网站
  • 学校建设网站做网站总结与体会
  • 厦门建设厅查询网站首页建筑人才网档案查询
  • 网站首页引导页模版类似设计师联盟的网站
  • 网站网站制作多少钱外贸网网站建设
  • 丽水市城市建设投资有限责任公司网站免费服务器的网站有哪些