赞
踩
网上的大多数介绍,都是文档 Vue-extend,真懒!
本效果在此基础上实现 Vue2项目中对百度地图的封装使用
video
就能播放的,是一些直播视频流// 自定义信息窗体样式 const html = `<div style="width:332px;height:275px;background-color:rgba(31, 41, 86, 1);box-shadow: 0px 0px 12px 0px rgba(0,119,255,0.8);text-align:left;border-radius: 6px;"> <div style="height:32px;line-height:32px;font-size:15px;font-weight:600;color:#fff;display:flex;justify-content:space-between;align-items:center;padding-left:16px;padding-right:16px;"> <div>标题</div><img @click="closePopWindow" src="/images/close.png" style="width:12px;height:12px;cursor:pointer;" /></div> <div style="height:28px;line-height:28px;font-size:12px;font-weight:400;color:#fff;padding-left:16px;"> 内容</div> <div style="width:300px;height:200px;border-radius:4px;border:1px solid #0D6EBE;margin-left:16px;"> <EasyPlayer style="width:100%;height:100%" :videoUrl="videoUrl" :live="true" :show-custom-button="false" :stretch="true" :autoplay="true" :isaspect="false" /> </div> </div>` const Profile = Vue.extend({ components: { EasyPlayer }, data() { return { videoUrl: '' } }, created() { this.getUrl(item.code) }, methods: { closePopWindow() { vm.bmap.closeInfoWindow() }, getUrl(code) { // 这里可以网络请求播放地址 this.videoUrl = 'https://player.alicdn.com/video/editor.mp4' } }, template: html }) marker.addEventListener('click', () => { const infoWindow = new BMap.InfoWindow(new Profile().$mount('').$el, { width: 332, height: 300, offset: new BMap.Size(-20, 20), enableAutoPan: true, enableMessage: false, title: '' }) marker.openInfoWindow(infoWindow) })
通过Vue.extend
,可简单实现地图信息弹窗的定制,template
里,可以加载第三方组件,实现设计的需求。
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。