From 69d2875826708725728107d41df1bd58a3fed4d0 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 23 Apr 2021 09:54:55 +0800 Subject: [PATCH] fix error tips in shop editor --- src/api/map.ts | 20 ++++++++++++++++++++ src/views/shop/edit.vue | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/api/map.ts b/src/api/map.ts index 98e6697..3919eb7 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -1,5 +1,25 @@ import request from '@/utils/request' +export interface ILocation { + lat: number, + lng: number +} + +/** + * 腾讯地图关键字输入提示返回的POI对象结构 + */ +export interface IAreaData { + address: string, + id: string, + title: string, + province: string, + city: string, + district: string, + adcode: string, + type: number, + location: ILocation +} + export async function queryArea(str: string, region: string) { let data = {keyword: str, region} return request({ diff --git a/src/views/shop/edit.vue b/src/views/shop/edit.vue index 9017f8d..68ab329 100644 --- a/src/views/shop/edit.vue +++ b/src/views/shop/edit.vue @@ -113,7 +113,7 @@ import UploadImage from '@/components/UploadImage/index.vue' import RegionPicker from '@/components/RegionPicker/index.vue' import { Form } from 'element-ui' import { defaultShopData, getShop, saveShop } from '@/api/shop' -import { addressToLoc, queryArea } from '@/api/map' +import { addressToLoc, IAreaData, queryArea } from '@/api/map' @Component({ name: 'ShopEditor', @@ -154,7 +154,7 @@ export default class extends Vue { } private tempTagView?: ITagView - private shopListOptions = [] + private shopListOptions: IAreaData[] = [] get lang() { @@ -265,8 +265,9 @@ export default class extends Vue { } this.shopListOptions = data.records } + private areaSelectChange(val: any) { - let result + let result: any for (let d of this.shopListOptions) { if (d.title == val) { result = d @@ -329,7 +330,7 @@ export default class extends Vue { width: 40px; position: absolute; right: 10px; - top: 0px; + top: 0; } }