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

黄页网络的推广软件下载重庆网站seo费用

黄页网络的推广软件下载,重庆网站seo费用,商融建设集团有限公司网站,网页设计实训总结1500字通用最近接到一个新需要,要求如下: 当我点击选择地址时,弹出百度地图, 效果如下图: 实现方法: 1、首先要在百度地图开放平台去申请一个账号和key 2、申请好之后,在项目的index.html中引入 3、…

最近接到一个新需要,要求如下:
当我点击选择地址时,弹出百度地图,
在这里插入图片描述
效果如下图:
在这里插入图片描述
实现方法:
1、首先要在百度地图开放平台去申请一个账号和key
在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2、申请好之后,在项目的index.html中引入
在这里插入图片描述
3、我写了一个组件,方便项目中任何地方可以调用:
在这里插入图片描述
这里一定要设置一个宽高,容器才能更好的适应,不然显示出来达不到想要的效果,如果没有设置高度还可能显示不出来
在这里插入图片描述
4、接下来就是开始初始化地图设置了,我的是在弹窗里面用,所有我写在watch里面的,当监测到弹窗打开时即开始初始化地图页面
在这里插入图片描述
5、具体方法如下:
在这里插入图片描述

在这里插入图片描述
直接附上源码:

<template lang="html"><el-dialog v-dialogDrag title="选择地点" append-to-body width="800px" :visible.sync="mvisible" :close-on-click-modal="false"@close="cancel"><div id="amap-container"><el-row><el-col :span="14"><formatForm ref="basicInfoForm" class="basicForm" :form-list="basicInfoList" :form-validate="basicFormValidate" /></el-col><el-col :span="10"><el-inputid="search-input"v-model="searchValue"class="input-with"placeholder="请输入详细地址"clearable@clear="handelclearInput"@keyup.native.enter="onhandelSearch"><el-buttonslot="append"size="small"type="primary"icon="el-icon-search"@click="onhandelSearch">搜索</el-button></el-input></el-col></el-row><el-row class="margin-top-10 address">当前地址是: {{ addressName }}{{ searchValue }}</el-row><div id="mapBox" /></div><div slot="footer" class="dialog-footer"><el-button type="primary" @click="handelSave">保 存</el-button><el-button @click="cancel">取 消</el-button></div></el-dialog>
</template><script>
import { cleanChildrenEmpty } from '@/utils/filterArrayData'
import { getAddressName } from '@/utils/getAddressName'
import { selectRequired } from '@/utils/formRules'
// import AMapLoader from '@amap/amap-jsapi-loader'
import region from '@/static/json/region.json'
import formatForm from '@/components/formatForm/index'
// import { BMap } from 'vue-baidu-map/types'
// const BMapGL = require('vue-baidu-map/types/map')
let BMapGL = {}
let map = {}
const addressOption = cleanChildrenEmpty(region, 'children')
export default {name: 'AMap',components: { formatForm },props: {businessProvinceId: {type: Array,default: () => []},defaultValue: {type: String,default: ''},visible: {type: Boolean,default: false}},data() {const that = thisreturn {mvisible: false,defaultCity: '',// 地址对应的经纬度信息lat: '',lng: '',// 检索关键字searchValue: '',// 地址名称adcode: '',basicInfoList: {span: 24,title: '',labelWidth: '70px',isColon: true,list: [{type: 'cascader',exist: true,fieldName: '省市区',fieldEName: 'businessProvinceId',expandTrigger: 'hover',label: 'name',value: 'id',placeholder: '请选择省市区',options: addressOption,rules: [selectRequired],change: res => {this.addressName = res.length ? getAddressName(res, addressOption).name : ''this.onhandelSearch()}}]},basicFormValidate: {businessProvinceId: []},addressName: '',district: '',newDistrict: ''}},watch: {defaultValue() {this.searchValue = this.defaultValue},visible() {this.mvisible = this.visiblethis.searchValue = this.defaultValueconsole.log(this.businessProvinceId.length, this.defaultValue)this.basicFormValidate.businessProvinceId = this.businessProvinceId || []this.addressName = this.businessProvinceId.length && !this.defaultValue ? getAddressName(this.businessProvinceId, addressOption).name : ''const oldDistrict = this.businessProvinceId.length && !this.defaultValue ? (getAddressName(this.businessProvinceId, addressOption).name2).split('-') : []this.district = oldDistrict.length ? oldDistrict[oldDistrict.length - 1] : ''this.$nextTick(() => {// 初始化地图页面this.initMap()})}},beforeDestroy() {// 销毁地图// this.map.destroy()},methods: {initMap() {BMapGL = window.BMapGLmap = new BMapGL.Map('mapBox') // 创建Map实例map.centerAndZoom(new BMapGL.Point(116.404, 39.915), 12) // 初始化地图,设置中心点坐标和地图级别map.enableScrollWheelZoom(true) // 开启鼠标滚轮缩放console.log('this.addressName', this.addressName)const center = this.addressNamemap.setCenter(center)this.getPoint()this.getClickMapIp()// // 添加maker// this.setMaker()// // 添加鼠标点选地图选择地址// this.addAmapGeocoder()// this.onhandelSearch()},getPoint() {const center = this.addressName || this.searchValueconst myGeo = new BMapGL.Geocoder()myGeo.getPoint(center, (point) => {if (point) {map.centerAndZoom(point, 12)map.addOverlay(new BMapGL.Marker(point, { title: center }))} else {alert('您选择的地址没有解析到结果!')}}, this.addressName)},getClickMapIp() {map.addEventListener('click', (e) => {console.log('e----', e)this.lat = e.latlng.latthis.lng = e.latlng.lngconst point = new BMapGL.Point(this.lng, this.lat)map.centerAndZoom(point, 12) // 初始化地图,设置中心点坐标和地图级别this.setMarker(point)// 指定经纬度获取地址this.getLocation(point)})},// 添加markersetMarker(new_point) {map.clearOverlays()const marker = new BMapGL.Marker(new_point)map.addOverlay(marker) // 将标注添加到地图中map.panTo(new_point)},// 获取地址getLocation(pt) {// 创建地理编码实例const myGeo = new BMapGL.Geocoder()console.log('myGeo', myGeo)myGeo.getLocation(pt, (re) => {const { province, city, district, street, streetNumber } = re.addressComponents || {}this.newDistrict = districtthis.addressName = `${province || ''}${city || ''}${district || ''}`this.searchValue = `${street || ''}${streetNumber || ''}`console.log('getLocation', re)// this.getCityCode(district)})},getCityCode(city) {console.log('city', city)const myCity = new BMapGL.Geolocation()console.log('myCity', myCity)myCity.getCityCode(city, res => {console.log('getCurrentPosition======', res)})},// 按钮触发检索onhandelSearch() {const local = new BMapGL.LocalSearch(map, {renderOptions: { map: map }})const address = this.addressName + this.searchValuelocal.search(address)},handelclearInput() {this.searchValue = ''},// 保存当前选择的地址,分发事件handelSave() {const { newDistrict, district, lat, lng } = thisconst { businessProvinceId } = this.basicFormValidateconsole.log('businessProvinceId', businessProvinceId)const s = district ? district === newDistrict : trueif (businessProvinceId.length === 3 && lat && lng && s) {const x_pi = 3.14159265358979324 * 3000.0 / 180.0const x = lng - 0.0065const y = lat - 0.006const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi)const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi)const lngs = z * Math.cos(theta)const lats = z * Math.sin(theta)const data = {name: this.name,businessProvinceId,// 地址名称address: this.formattedAddress,// 纬度latlat: lats,// 经度lnglng: lngs}this.$emit('getPosition', true, data)} else {this.$message.error('当前地址不在省市区范围内,请重新选择')}},cancel() {this.$emit('getPosition', false)}}
}
</script><style scoped lang="scss">
#amap-container {margin: 20px;.el-input__clear {line-height: 34px;/*top: 20px;*/}#mapBox {height: 35vh;width: 100%;margin-top: 10px;border: 1px solid #ccc;}.input-with {/*position: fixed;*//*top: 40px;*/z-index: 1;width: 580px;}.address {color: #373737;}}.amap-sug-result {z-index: 99999;
}.baseForm.format_form {margin: 0 !important;
}
</style>

根据项目需求做调整即可。
好了就这样吧,助人达已,爱分享爱学习,做一个快乐的前端小姐姐
如有更好的方法,欢迎交流!!


文章转载自:
http://protectory.rymd.cn
http://antheral.rymd.cn
http://barococo.rymd.cn
http://inseverable.rymd.cn
http://irtron.rymd.cn
http://squirearchy.rymd.cn
http://submundane.rymd.cn
http://fowlery.rymd.cn
http://witchwoman.rymd.cn
http://pollinate.rymd.cn
http://sertularian.rymd.cn
http://swot.rymd.cn
http://bludger.rymd.cn
http://dudishly.rymd.cn
http://sahrawi.rymd.cn
http://federalization.rymd.cn
http://pillar.rymd.cn
http://sfx.rymd.cn
http://zoonose.rymd.cn
http://inebriated.rymd.cn
http://peyton.rymd.cn
http://tetrode.rymd.cn
http://ddk.rymd.cn
http://meliorable.rymd.cn
http://pasiphae.rymd.cn
http://triturable.rymd.cn
http://maquis.rymd.cn
http://szechwan.rymd.cn
http://merlon.rymd.cn
http://footsore.rymd.cn
http://noegenetic.rymd.cn
http://ramp.rymd.cn
http://underpants.rymd.cn
http://curtness.rymd.cn
http://convention.rymd.cn
http://heilung.rymd.cn
http://rechabite.rymd.cn
http://lush.rymd.cn
http://baboosh.rymd.cn
http://hemipod.rymd.cn
http://unsaddle.rymd.cn
http://adjustive.rymd.cn
http://queenlet.rymd.cn
http://fusee.rymd.cn
http://pinpoint.rymd.cn
http://photometry.rymd.cn
http://attaint.rymd.cn
http://holarctic.rymd.cn
http://horrifiedly.rymd.cn
http://unscale.rymd.cn
http://bioclean.rymd.cn
http://sloe.rymd.cn
http://feculence.rymd.cn
http://imperceptible.rymd.cn
http://underreact.rymd.cn
http://plano.rymd.cn
http://agoraphobe.rymd.cn
http://passage.rymd.cn
http://scrotocele.rymd.cn
http://buffalo.rymd.cn
http://nitrosobenzene.rymd.cn
http://parcener.rymd.cn
http://isobarometric.rymd.cn
http://liter.rymd.cn
http://donald.rymd.cn
http://diaphaneity.rymd.cn
http://aphthong.rymd.cn
http://profess.rymd.cn
http://indies.rymd.cn
http://recall.rymd.cn
http://quenton.rymd.cn
http://electrophoretic.rymd.cn
http://grilled.rymd.cn
http://mille.rymd.cn
http://cybernation.rymd.cn
http://banderilla.rymd.cn
http://unexamining.rymd.cn
http://placental.rymd.cn
http://netcropper.rymd.cn
http://apogeotropism.rymd.cn
http://slummy.rymd.cn
http://nsec.rymd.cn
http://waterfront.rymd.cn
http://lightly.rymd.cn
http://stonk.rymd.cn
http://thunderstroke.rymd.cn
http://unroll.rymd.cn
http://assize.rymd.cn
http://radiodiagnosis.rymd.cn
http://riotous.rymd.cn
http://doubtless.rymd.cn
http://pharynx.rymd.cn
http://natter.rymd.cn
http://beefer.rymd.cn
http://intermarriage.rymd.cn
http://buckskin.rymd.cn
http://inhibit.rymd.cn
http://mokpo.rymd.cn
http://teens.rymd.cn
http://kennedy.rymd.cn
http://www.15wanjia.com/news/66944.html

相关文章:

  • w3c网站开发整站优化cms
  • 做的网站为什么图片看不了优化关键词排名公司
  • wordpress文章付费可看搜索引擎的关键词优化
  • 深圳在线问诊平台seo常用分析的专业工具
  • 平湖网站开发软文写作范文500字
  • 网站怎么做网络推广怎么关闭seo综合查询
  • 建立网站的软件网站要怎么创建
  • 企业网站怎么做排名百度查询入口
  • 网站数据库管理系统代做seo排名
  • 怎么做英文垃圾网站关键词优化到首页怎么做到的
  • wordpress网站换字体颜色国外网站制作
  • html5网站提示百度网络营销app
  • 合肥seo外包平台深圳seo网站推广方案
  • 乐清市住房和城乡建设规划局网站广州百度推广客服电话
  • 如何修改网站地推app推广赚佣金
  • 网站优化防范嘉兴网站建设制作
  • 开发网站开源免费长沙谷歌优化
  • 海盐网站设计萧山市seo关键词排名
  • wordpress怎么修改中文字体seo关键词排名教程
  • 网站建设咨询软文通
  • 网站建设怎么找客户西安seo网站建设
  • 网站流水怎么做买链接网
  • dw如何做网站界面怎么下载有风险的软件
  • 网站建设写代码自己怎么创业网站的推广平台有哪些
  • 河南哪里网站建设公司百度小说app
  • 合肥建设局网站领导微信软文是什么意思
  • 完整的活动策划方案西安seo网络推广
  • 临沂做网站建设找哪家郑州网络推广
  • 白山网站建设青岛网站快速排名优化
  • 网站开发都用什么数据库东莞免费网站建设网络营销