cf D.零数量最大化+map的使用

题目链接:http://codeforces.com/contest/1133/problem/D
题目大意:给你一个n。及其a[1]…a[n]。 b[1]…b[n]。然后让你选择一个合适的d让d*a[i]+b[i]的数量最多。并且输出最多的数量值。

在这里插入图片描述
思路:很简单:把所有的a[i], b[i]取得gcd。排序,统计数量最多。
因为a[i], b[i]可能等于0。这里给我上了一课。

__gcd(0, 0)=0
__gcd(0, a)=a	//a可正可负。
__gcd(a, b)     //结果与b的符号相同
排序的时候用a[1]*b[2]>a[2]*b[1]错了。
例如(0/-5   1/2)和(0/5 1/2)

还要特判a[i]==0&&b[i]==0和a[i]==0&&b[i]!=0
为什么不特判:a[i]==0&&b[i]!=0。
因为__gcd(a[i], b[i])=b[i]。
最后都变成0 1
统计的时候只能用:
map<pair<int, int>, int> p;
p[{a[i], b[i]}]++;

如果范围比较小,还可以
map<int, int> p[maxn];
p[a[i]][b[i]]++;
#include<bits/stdc++.h>
#define LL long long
#define p1 first
#define p2 second
using namespace std;
const int mod=1e9+7;
//memset(a, 0, sizeof(a));
//stack堆栈 queue队列 priority_queue优先队列
//vector向量 multiset平衡二叉树 deque双端队列
//pair{T1 first;T2 second;} greater<T>
//unordered_map 哈希map

int a[200005];
int b[200005];
map<pair<int, int>, int > p;

int main()
{
    int n, u=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }
    for(int i=0; i<n; i++)
    {
        scanf("%lld",&b[i]);
    }
    for(int i=0; i<n; i++)
    {
        if(a[i]==0&&b[i]==0)
        {
            u++;
        }
        else if(a[i]==0)
        {

        }
        else
        {
            LL g=__gcd(a[i], b[i]);
            a[i]/=g, b[i]/=g;
            p[{a[i], b[i]}]++;
        }
    }
    int MAX=0;
    for(map<pair<int, int>, int >::iterator i=p.begin();i!=p.end();i++)
    {
        MAX=max(int(i->p2), MAX);
    }
    cout<<MAX+u<<endl;

    return 0;
}
跟样式百分之百没关系,你参考一下这个代码里日期的数据 // pages/stats/stats.js const eventBus = require('../../utils/event-bus.js'); Page({ data: { loading: true, dataType: 0, dataTypes: ['步数', '饮水', '睡眠'], years: ['2023', '2024', '2025'], months: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'], selectedYear: '2025', selectedMonth: '06', statsData: { average: 0, max: 0, completion: 0 }, chartData: { labels: [], values: [] }, // 添加重绘标志 needRedraw: false }, onLoad() { // 初始化事件总线 this.initEventBus(); // 设置默认日期为当前年月 const now = new Date(); this.setData({ selectedYear: now.getFullYear().toString(), selectedMonth: (now.getMonth() + 1).toString().padStart(2, '0') }, () => { this.loadStats(); }); }, // 初始化事件总线(关键修复) initEventBus() { this.dataUpdatedListener = () => { console.log('收到数据更新事件,重新加载统计'); this.loadStats(); }; eventBus.on('healthDataUpdated', this.dataUpdatedListener); }, onUnload() { eventBus.off('healthDataUpdated', this.dataUpdatedListener); }, onShow() { // 页面显示时强制重绘 if (this.data.needRedraw) { this.setData({ needRedraw: false }, () => { setTimeout(() => this.drawChart(), 100); }); } }, // 加载统计数据(关键修复) loadStats() { const app = getApp(); const records = app.getAllRecords(); const filteredRecords = this.filterRecordsByMonth(records); // 准备图表数据 const chartData = this.prepareChartData(filteredRecords); // 计算统计数据 const statsData = this.calculateStats(filteredRecords); this.setData({ statsData, chartData, loading: false, needRedraw: true // 设置重绘标志 }, () => { // 等待视图更新后绘制 setTimeout(() => { this.drawChart(); }, 300); }); }, // 修复日期筛选逻辑 filterRecordsByMonth(records) { const { selectedYear, selectedMonth } = this.data; return records.filter(record => { const [year, month] = record.date.split('-'); const normalizedMonth = month.padStart(2, '0'); return year === selectedYear && normalizedMonth === selectedMonth; }).sort((a, b) => new Date(a.date) - new Date(b.date)); }, // 准备图表数据 prepareChartData(records) { const labels = []; const values = []; records.forEach(record => { const day = record.date.split('-')[2]; labels.push(`${parseInt(day)}`); // 直接映射类型字段 const typeMap = { 0: 'steps', 1: 'water', 2: 'sleep' }; const typeKey = typeMap[this.data.dataType]; values.push(typeKey ? record[typeKey] || 0 : 0); }); return { labels, values }; }, // 计算统计数据 calculateStats(records) { if (!records || records.length === 0) { return { average: 0, max: 0, completion: 0 }; } // 直接映射类型字段 const typeMap = { 0: 'steps', 1: 'water', 2: 'sleep' }; const typeKey = typeMap[this.data.dataType]; const values = records.map(r => r[typeKey] || 0); const sum = values.reduce((acc, val) => acc + val, 0); const average = values.length > 0 ? (sum / values.length).toFixed(1) : 0; const max = Math.max(...values); const app = getApp(); const userInfo = app.globalData.userInfo; let target = 0; switch (this.data.dataType) { case 0: target = userInfo.target_steps || 10000; break; case 1: target = userInfo.target_water || 2.5; break; case 2: target = userInfo.target_sleep || 8; break; } let completion = 0; if (target > 0 && average > 0) { completion = (average / target) * 100; completion = Math.min(100, completion).toFixed(0); } return { average, max, completion }; }, // 切换数据类型 changeDataType(e) { this.setData({ dataType: e.detail.value }, () => { this.loadStats(); }); }, // 切换年份 changeYear(e) { this.setData({ selectedYear: this.data.years[e.detail.value] }, () => { this.loadStats(); }); }, // 切换月份 changeMonth(e) { this.setData({ selectedMonth: this.data.months[e.detail.value] }, () => { this.loadStats(); }); }, // 关键修复:确保Canvas正确销毁和重绘 drawChart() { // 销毁旧Canvas上下文 if (this.ctx) { try { this.ctx = null; } catch (e) { console.warn('Canvas上下文销毁异常', e); } } // 创建新Canvas上下文 this.ctx = wx.createCanvasContext('chartCanvas'); const { labels, values } = this.data.chartData; // 清除画布 this.ctx.clearRect(0, 0, 320, 200); this.ctx.draw(true); if (labels.length === 0) { console.log('无数据,跳过绘图'); return; } const canvasWidth = 320; const canvasHeight = 200; const paddingLeft = 45; const paddingTop = 25; const paddingRight = 25; const paddingBottom = 35; const chartWidth = canvasWidth - paddingLeft - paddingRight; const chartHeight = canvasHeight - paddingTop - paddingBottom; // 绘制坐标轴 this.ctx.beginPath(); this.ctx.moveTo(paddingLeft, paddingTop); this.ctx.lineTo(paddingLeft, paddingTop + chartHeight); this.ctx.lineTo(paddingLeft + chartWidth, paddingTop + chartHeight); this.ctx.strokeStyle = '#ddd'; this.ctx.stroke(); // 确定最大值 let maxValue = Math.max(...values, 1); // 确保最小值至少为1 // 根据数据类型调整最大值 if (this.data.dataType === 0) maxValue = Math.max(maxValue, 50000); else if (this.data.dataType === 1) maxValue = Math.max(maxValue, 5); else if (this.data.dataType === 2) maxValue = Math.max(maxValue, 12); // 绘制数据点和折线 const pointRadius = 4; const dataPoints = []; for (let i = 0; i < values.length; i++) { const x = paddingLeft + (i / (labels.length - 1)) * chartWidth; const y = paddingTop + chartHeight - (values[i] / maxValue) * chartHeight; dataPoints.push({ x, y }); this.ctx.beginPath(); this.ctx.arc(x, y, pointRadius, 0, Math.PI * 2); this.ctx.fillStyle = '#2c9cf1'; this.ctx.fill(); this.ctx.font = '10px sans-serif'; this.ctx.fillStyle = '#666'; this.ctx.textAlign = 'center'; this.ctx.fillText(labels[i], x, paddingTop + chartHeight + 15); } // 绘制折线 this.ctx.beginPath(); this.ctx.moveTo(dataPoints[0].x, dataPoints[0].y); for (let i = 1; i < dataPoints.length; i++) { this.ctx.lineTo(dataPoints[i].x, dataPoints[i].y); } this.ctx.strokeStyle = '#2c9cf1'; this.ctx.lineWidth = 2; this.ctx.stroke(); // 绘制值标签 for (let i = 0; i < values.length; i++) { let displayValue; switch (this.data.dataType) { case 0: displayValue = `${values[i]}步`; break; case 1: displayValue = `${values[i]}L`; break; case 2: displayValue = `${values[i]}小时`; break; default: displayValue = values[i].toString(); } this.ctx.font = '10px sans-serif'; this.ctx.fillStyle = '#2c9cf1'; this.ctx.textAlign = 'center'; this.ctx.fillText(displayValue, dataPoints[i].x, dataPoints[i].y - 10); } // 绘制Y轴刻度 this.ctx.font = '10px sans-serif'; this.ctx.fillStyle = '#666'; this.ctx.textAlign = 'right'; this.ctx.textBaseline = 'middle'; for (let i = 0; i <= 3; i++) { const value = (maxValue * (3 - i) / 3).toFixed(1); const y = paddingTop + (chartHeight * i) / 3; this.ctx.beginPath(); this.ctx.moveTo(paddingLeft - 5, y); this.ctx.lineTo(paddingLeft, y); this.ctx.strokeStyle = '#ddd'; this.ctx.stroke(); this.ctx.fillText(value, paddingLeft - 8, y); } // 确保绘制完成 this.ctx.draw(true); } });
06-13
<!-- hybrid/html/map.html --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>高德地图</title> <!-- <script src="https://webapi.amap.com/loader.js"></script> --> <script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script> <style> #map-container { width: 100%; height: 584px; border-radius: 22px; z-index: 4; } /* 新增:隐藏高德默认标记图标 */ #map-container .amap-marker img[src*="mark_bs.png"] { display: none !important; } </style> </head> <body> <div id="map-container"></div> <script type="text/javascript" src="./js/uni.webview.0.1.52.js"> </script> <script> window._AMapSecurityConfig = { securityJsCode: 'cf331d54f67e306ca5c0b17f7122d559' }; </script> <script src="https://webapi.amap.com/maps?v=2.0&key=f3323c24769b10828db07f07c0fcec0d&plugin=AMap.MarkerCluster"> </script> <script src="https://webapi.amap.com/ui/1.1/main.js"></script> <script> // 确保UniApp通信桥接准备就绪 function setupUniBridge() { return new Promise(resolve => { if (typeof uni.postMessage === 'function') { return resolve(); } document.addEventListener('UniAppJSBridgeReady', resolve); }); } // 向UniApp发送消息(兼容H5和App环境) async function sendMessageToUniApp(data) { // 1. 确保桥接就绪(仅对App环境有效,H5环境会直接resolve) await setupUniBridge(); // 2. 区分环境发送消息 if (isH5Environment()) { // H5环境:使用浏览器原生postMessage console.log('H5环境,使用window.parent.postMessage发送消息'); window.parent.postMessage({ type: 'webviewMessage', // 自定义类型,方便UniApp识别 data: JSON.stringify(data) }, '*'); // 第三个参数为目标域名,*表示允许所有(开发环境可用,生产环境需指定具体域名) } else if (window.uni && typeof uni.postMessage === 'function') { // App环境:使用uni.postMessage console.log('App环境,使用uni.postMessage发送消息'); uni.postMessage({ data: JSON.stringify(data) }); } else { console.error('未支持的环境,无法发送消息'); } } // 辅助函数:判断是否为H5环境(浏览器环境) function isH5Environment() { const protocol = window.location.protocol; // H5环境的协议通常是http:或https: return protocol === 'http:' || protocol === 'https:'; } // 解析URL参数 const params = new URLSearchParams(location.search); const points = JSON.parse(params.get('points') || '[]'); const markers = JSON.parse(params.get('markers') || '[]'); // 初始化地图 const map = new AMap.Map('map-container', { zoom: 10, center: [points[0].lng, points[0].lat], showBuildingBlock: true }); // 自定义单个标记内容(保持原有样式,修复图片路径) function createMarkerContent(markerData) { // 优先使用本地图片,失败则用备用图(确保是自定义图标) const imageUrl = './img/flag.png'; return ` <div style="position:relative;z-index:1000;"> <img src="${imageUrl}" style="width:30px; height:30px;" alt="${markerData.title}"> <div style="position:absolute; bottom:-20px; left:50%; transform: translateX(-50%); background: #f5e7e7; padding:3px 8px; border-radius: 18px; white-space:nowrap; font-family:ShuHuiTi, sans-serif; font-size: 12px; font-weight: bold; border: 2px solid #F47C58; color:#E4393C;"> ${markerData.title} </div> </div> `; } // 聚合点渲染函数 function _renderClusterMarker(context) { const count = context.count; console.log('渲染聚合点,数量:', count); // 通过JS直接设置样式(优先级更高) const div = document.createElement('div'); div.innerHTML = count; // 强制设置关键样式(覆盖默认) div.style.width = '40px'; div.style.height = '40px'; div.style.backgroundColor = '#FF9A44'; div.style.borderRadius = '50%'; div.style.display = 'flex'; div.style.alignItems = 'center'; div.style.justifyContent = 'center'; div.style.color = 'white'; div.style.fontWeight = 'bold'; // 设置聚合点偏移(确保居中) context.marker.setOffset(new AMap.Pixel(-20, -20)); context.marker.setContent(div); // 通过context.marker设置内容 } // 单个标记渲染函数 function _renderMarker(context) { const markerData = context.data[0].originalData; // 1. 生成标记内容 const content = createMarkerContent(markerData); // 2. 设置标记内容 context.marker.setContent(content); // 3. 校准偏移量(根据内容尺寸计算,确保标记中心与经纬度对齐) // 内容总高度:图片30px + 标题区域20px = 50px,向上偏移50px使底部对齐定位点 context.marker.setOffset(new AMap.Pixel(-15, -50)); // 水平偏移:30px宽/2=15px // 4. 绑定点击事件 context.marker.on('click', async () => { const message = { type: 'markerClick', data: markerData }; console.log('H5发送消息:', message); // 优先使用uni.postMessag await sendMessageToUniApp({ type: 'markerClick', data: markerData }); }); } // 绘制路线(保持原有功能) function drawRouteAndPoints() { if (points.length === 0) return; const path = points.map(p => [p.lng, p.lat]); new AMap.Polyline({ path: path, strokeColor: "#32CD32", strokeWeight: 5, zIndex: 500, map: map }); if (points.length >= 2) { AMap.plugin('AMap.Driving', () => { const driving = new AMap.Driving({ map: map, policy: AMap.DrivingPolicy.LEAST_TIME, zIndex: 550 }); driving.search( [points[0].lng, points[0].lat], [points[points.length - 1].lng, points[points.length - 1].lat] ); }); } } // 初始化聚合标记 function initClusterMarkers() { if (!markers.length) return; // 转换数据格式为官方示例要求的结构(包含lnglat字段) const clusterPoints = markers.map(marker => ({ lnglat: new AMap.LngLat(marker.lng, marker.lat), // 官方要求的经纬度格式 originalData: marker // 保留原始数据供渲染使用 })); // 参考官方示例:插件加载后初始化聚合 AMap.plugin('AMap.MarkerCluster', function() { if (typeof AMap.MarkerCluster === 'undefined') { console.error('聚合插件加载失败'); return; } // 配置聚合参数 const cluster = new AMap.MarkerCluster(map, clusterPoints, { gridSize: 80, // 网格大小(官方示例默认60,可调整) maxZoom: 15, // 最大聚合级别 minClusterSize: 2, // 最小聚合数量(测试时可改为1) zoomOnClick: true, averageCenter: true, zIndex: 2000, // 聚合点参数名 renderClusterMarker: _renderClusterMarker, // 单个标记参数名 renderMarker: _renderMarker }); // 调整视野 const bounds = new AMap.Bounds(); clusterPoints.forEach(point => bounds.extend(point.lnglat)); map.setBounds(bounds, [50, 50, 50, 50]); }); } // 地图加载完成后初始化 map.on('complete', function() { console.log('地图加载完成,初始化组件'); initClusterMarkers(); if (points.length > 0) drawRouteAndPoints(); }); map.on('error', (err) => console.error('地图错误:', err)); // 构建带标题的HTML内容 // markers.forEach(marker => { // // 构建HTML内容(包含图片和标题) // const content = ` // <div style="background: linear-gradient(180deg, #E3383B 0%, #F47C58 98%); padding:6px; border-radius: 8px;"> // <div style=" white-space:wrap; // font-family:AlibabaPuHuiTi-SemiBold; font-size: 15px; // margin-top:5px;color:#fff;width:100%;">闽宁新貌展示中心</div> // <div style=" white-space:wrap;text-indent: 1em;letter-spacing: 1px; // font-family:AlibabaPuHuiTi-RegularL3; font-size: 10px; // margin-top:5px;color:#fff;width:100%;"> // 闽宁新貌展示中心,生动呈现闽宁协作丰硕成果,见证昔日“干沙滩”蜕变为今日“金沙滩”的壮丽历程。 </div> // <img src="./img/ditu.png" style="width:200px; height:110px; display:block;margin-top:5px;"> // </div> // `; // const markerObj = new AMap.Marker({ // position: [marker.lng, marker.lat], // content: content, // 使用HTML内容 // anchor: 'bottom-center', // 锚点在底部中心 // offset: new AMap.Pixel(0, -25) // 向上偏移 // }); // markerObj.on('click', () => { // console.log('window--uni', uni, window); // // console.log(marker, '000'); // // 将数据转为字符串 // const message = JSON.stringify({ // type: 'markerClick', // title: marker.title // }); // window.parent.postMessage(message, '*'); // // 通过uni.postMessage发送数据 // // uni.postMessage({ // // data: JSON.stringify(message) // 发送字符串 // // }); // }); // map.add(markerObj); // }); // 2.map加载完成后初始化聚合点 // map.on('complete', function() { // // 创建聚合实例 // const cluster = new AMap.MarkerClusterer(map, markers.map(m => { // return new AMap.Marker({ // position: [m.lng, m.lat], // content: createMarkerContent(m) // 自定义标记 // }); // }), { // gridSize: 80, // maxZoom: 18, // renderClusterMarker: renderCluster // }); // // // 转换数据格式 // // const clusterPoints = markers.map(marker => ({ // // lnglat: [marker.lng, marker.lat], // // title: marker.title, // // originalData: marker // 保留原始数据 // // })); // // console.log('在map加载完成后初始化聚合点', clusterPoints); // // // 确保有聚合点数据 // // if (clusterPoints.length === 0) return; // // 使用MarkerCluster插件 // // AMap.plugin('AMap.MarkerCluster', function() { // // console.log("聚合插件加载完成"); // // // 创建聚合点 // // const cluster = new AMap.MarkerCluster(map, clusterPoints, { // // gridSize: 80, // 聚合网格像素大小 // // maxZoom: 18, // 最大聚合级别 // // minClusterSize: 2, // 最小聚合数量 // // zoomOnClick: true, // 点击聚合点是否放大地图 // // averageCenter: true, // 聚合点是否使用平均值中心 // // // 定义聚合点样式 // // renderClusterMarker: function(context) { // // console.log('定义聚合点样式-context', context); // // // const count = context.count; // // // const div = document.createElement('div'); // // // div.innerHTML = ` // // // <div style="background: #FF9A44; // // // border-radius: 50%; // // // width: 40px; // // // height: 40px; // // // display: flex; // // // align-items: center; // // // justify-content: center; // // // color: white; // // // font-weight: bold; // // // z-index:99;"> // // // ${count} // // // </div> // // // `; // // const count = context.count; // // const div = document.createElement('div'); // // div.style.background = '#FF9A44'; // // div.style.borderRadius = '50%'; // // div.style.width = '40px'; // // div.style.height = '40px'; // // div.style.display = 'flex'; // // div.style.alignItems = 'center'; // // div.style.justifyContent = 'center'; // // div.style.color = 'white'; // // div.style.fontWeight = 'bold'; // // div.style.zIndex = '99'; // // div.innerHTML = count; // // // context.marker.setContent(div); // // return div; // // }, // // // 自定义标记点样式 // // renderMarker: function(context) { // // const markerData = context.data[0].originalData; // // // console.log('自定义标记点样式-context', context); // // // const marker = new AMap.Marker({ // // // position: [markerData.lng, markerData.lat], // // // content: ` // // // <div style="position:relative; text-align:center;z-index:100;"> // // // <img src="./img/flag.png" // // // style="width:40px; height:50px; display:block;"> // // // <div style="position:absolute; bottom:-90%; left:0%; transform:translateX(-50%); // // // background: rgba(227, 57, 59, 0.1); padding:6px 0; // // // border-radius: 18px; white-space:wrap; // // // font-family:ShuHuiTi; font-size: 12px;font-weight: bold; // // // margin-top:5px;border: 2px solid #F47C58;color:#E4393C;width:80px;"> // // // ${markerData.title} // // // </div> // // // </div> // // // `, // // // offset: new AMap.Pixel(0, 0) // // // }); // // // 创建自定义内容 // // const content = ` // // <div style="position:relative; text-align:center;z-index:100;"> // // <img src="./img/flag.png" style="width:40px; height:50px; display:block;"> // // <div style="position:absolute; bottom:-90%; left:50%; transform:translateX(-50%); // // background: rgba(227, 57, 59, 0.1); padding:6px 0; font-family:ShuHuiTi; font-size: 12px;font-weight: bold; // // margin-top:5px;border: 2px solid #F47C58;color:#E4393C;width:80px; border-radius: 18px;"> // // ${markerData.title} </div> </div> `; // // const marker = new AMap.Marker({ // // position: [markerData.lng, markerData.lat], // // content: content, // // offset: new AMap.Pixel(-2, -4) // 根据实际图片调整偏移 // // }); // // // 绑定聚合点点击事件 // // // marker.on('click', async function(e) { // // // console.log(e, 'bbbbb'); // // // sendMessageToUniApp({ // // // type: 'markerClick', // // // center: e.lnglat // // // }); // // // }); // // // // console.log('聚合点点', marker); // // // map.add(marker); // // // 绑定标记点击事件 // // marker.on('click', async function(e) { // // 发送消息给UniApp // // await sendMessageToUniApp({ // // type: 'markerClick', // // data: markerData // // }); // // }); // // return marker; // // }, // // }); // // // 绑定聚合点点击事件 // // cluster.on('click', async function(e) { // // console.log(e, 'bbbbb'); // // // 发送聚合点点击事件 // // await sendMessageToUniApp({ // // type: 'clusterClick', // // data: { // // count: e.clusterData.count, // // center: e.clusterData.center, // // markers: e.clusterData.markers // // } // // }); // // }); // // }); // }); // 2. 绘制路线 // const path = points.map(p => [p.lng, p.lat]); // new AMap.Polyline({ // path: path, // strokeColor: "#32CD32", // strokeWeight: 5, // map: map // }); // 3. 添加起点终点标记 // points.forEach((point, i) => { // new AMap.Marker({ // position: [point.lng, point.lat], // // content: `<div class="point-label">${i === 0 ? '起' : '终'}</div>`, // offset: new AMap.Pixel(-10, -10), // map: map // }); // }); // 4. 绘制驾车路径(如果需要,可以注释掉直线路径,保留驾车路径) // 注意:这里同时绘制了直线和驾车路径,可能会重叠 // if (points.length >= 2) { // AMap.plugin('AMap.Driving', () => { // const driving = new AMap.Driving({ // map: map, // 这样驾车路线会直接显示在地图上 // policy: AMap.DrivingPolicy.LEAST_TIME // }); // driving.search( // [points[0].lng, points[0].lat], // [points[points.length - 1].lng, points[points.length - 1].lat], // (status, result) => { // // 可以根据结果处理 // } // ); // }); // } // 1. 绘制路线 // if (points.length > 0) { // const path = points.map(p => [p.lng, p.lat]); // new AMap.Polyline({ // path: path, // strokeColor: "#32CD32", // strokeWeight: 5, // map: map // }); // // 添加起点终点标记 // points.forEach((point, i) => { // new AMap.Marker({ // position: [point.lng, point.lat], // offset: new AMap.Pixel(-10, -10), // map: map // }); // }); // // 绘制驾车路径(如果需要) // if (points.length >= 2) { // AMap.plugin('AMap.Driving', () => { // const driving = new AMap.Driving({ // map: map, // policy: AMap.DrivingPolicy.LEAST_TIME // }); // driving.search( // [points[0].lng, points[0].lat], // [points[points.length - 1].lng, points[points.length - 1].lat] // ); // }); // } // } </script> </body> </html>点击点标记只有console.log('H5发送消息:', message);这个打印,其他的没有反应
08-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值