Appearance
fpi-map-location地图经纬度选择
TIP
当前组件在 element-plus-expand
<template>
<fpi-map-location
v-model="form.position"
:to-fixed-num="8"
@get-address="getAddress"
/>
</template>
<script setup lang="ts">
import { reactive, toRefs } from 'vue'
const state = reactive({
form: {
// position: [120.172332, 30.175451], // 纬度 经度
position: [], // 纬度 经度
address: ''
}
})
/**
* 获取点击地图的位置
* @param address
*/
function getAddress(address: any) {
state.form.address = address
}
const { form } = toRefs(state)
</script>
显示代码
属性
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
toFixedNum | 经纬度位数修约,这样也会影响手动输入的位数 | number | - | 6 |
title | 弹框标题 | string | - | 请在地图上单击选择坐标点 |
style | 弹框样式 | object | - | {} |
v-model | 经纬度的值用于回显 | number[] | - | [120.193938105986, 30.190082529340692] |
事件
事件名 | 说明 | 参数 |
---|---|---|
getAddress | 选择地图点位后,向外发送的事件。 | 当前选则的位置地址 |
插槽
插槽名 | 说明 |
---|---|
img | 自定义经纬度输入框旁的图标 |