文本标注

示例

查看代码
<template>
  <button @click="state.visible = !state.visible">visible:{{ state.visible }}</button>
  <div class="mapDiv">
    <tdt-map :center="state.center" :zoom="state.zoom">
      <tdt-label :position="state.center" text="Hello World!" :visible="state.visible"></tdt-label>
    </tdt-map>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from "vue-demi";

const state = reactive({
  center: [113.280637, 23.125178],
  zoom: 11,
  visible: true
});
</script>

<script lang="ts">
export default { name: "demo-label" };
</script>

<style scoped>
.mapDiv {
  width: 100%;
  height: 300px;
}
</style>

属性

属性类型默认值说明
textString""文本标注的内容
offsetArray[0,0]文本标注的位置偏移值
positionArray[0,0]文本标注的地理位置
titleString文本的提示内容
zindexNumberz-index
fontSizeNumber文本的字体大小
fontColorString文本的字体颜色
backgroundColorString文本的背景颜色
borderLineNumber文本的边框线宽
borderColorString文本的边框颜色
opacityNumber文本的显示不透明度
visibleBooleantrue是否可见
extData自定义属性

事件

事件参数描述
click({type,target,lnglat,containerPoint,extData})点击文本标注后会触发此事件
dblclick({type,target,lnglat,containerPoint,extData})双击文本标注后会触发此事件
mousedown({type,target,lnglat,containerPoint,extData})鼠标在文本标注上按下触发此事件
mouseup({type,target,lnglat,containerPoint,extData})鼠标在文本标注释放触发此事件
mouseout({type,target,lnglat,containerPoint,extData})鼠标离开文本标注时触发此事件