function makeurl(b){
//你在這里就已經returnle
return b+"?x="+Math.round(1E5_tx)/1E5+"&y="+Math.round(1E5_ty)/1E5+"&zoom="+map.getZoom();
//函數根本執行不到這里啊
L.marker([tx,ty], {icon}).addTo(map);
}
沒有足夠的數據
(??? )
暫時沒有任何數據
hfhan 回答了問題 · 今天 08:53
function makeurl(b){
//你在這里就已經returnle
return b+"?x="+Math.round(1E5_tx)/1E5+"&y="+Math.round(1E5_ty)/1E5+"&zoom="+map.getZoom();
//函數根本執行不到這里啊
L.marker([tx,ty], {icon}).addTo(map);
}
{代碼...}
關注 1 回答 1
hfhan 回答了問題 · 3月2日
var north = L.control({position: "bottomright"});
north.onAdd = function(map) {
var div = L.DomUtil.create("div", "info legend");
div.innerHTML = `
<input type="checkbox" name="" class="mycho" value="" />顯示/隱藏圖片
<br>
<img data-original="qq.png">
`;
return div;
}
north.addTo(map);
然后css去控制
.mycho:checked ~ img{
display: none;
}
{代碼...} 然后css去控制 {代碼...}
關注 1 回答 2
hfhan 回答了問題 · 3月2日
就是數據拷貝,簡單的就用淺拷貝,比如JSON.parse(JSON.stringify(item))
,或者Object.assign
arr1.reduce((list, item) => {
let res = arr2.map(item2 => {
let o = JSON.parse(JSON.stringify(item))
o.c = item2.e
return o
})
return list.concat(res)
}, [])
就是數據拷貝,簡單的就用淺拷貝,比如JSON.parse(JSON.stringify(item)),或者Object.assign {代碼...}
關注 1 回答 1
hfhan 回答了問題 · 3月2日
你上一個問題中不是已經實現了添加標記了?
L.marker
是根據經緯度生成一個標記,后面的addTo(map)
是把該標記添加到地圖中,這很容易理解,用你的代碼就是
function load() {
local = new BMap.LocalSearch("\u5168\u56fd", {
onSearchComplete: function (c) {
if (local.getStatus() != BMAP_STATUS_SUCCESS) openInfo("no");
else {
var d = c.getPoi(0).point; c = c.getPoi(0).address; var e = map.getZoom(); d = bdtowg(d.lng, d.lat); 15 > e && map.setZoom(18); map.setView(d);
L.popup().setLatLng(d).setContent(c).openOn(map)
L.marker(d).addTo(map)//.bindPopup(c).openPopup(); //注釋的是彈框
}
}
});
}
你上一個問題中不是已經實現了添加標記了?添加marker到地圖L.marker是根據經緯度生成一個標記,后面的addTo(map)是把該標記添加到地圖中,這很容易理解,用你的代碼就是 {代碼...}
關注 1 回答 1
hfhan 回答了問題 · 3月2日
function transData(data){
let obj = {}
data.forEach(item => {
let list = item.split('/')
list.reduce((parent, citem) => {
return (parent[citem] = parent[citem] || {})
}, obj)
})
return loop(obj)
}
function loop(obj){
return Object.keys(obj).map(key => {
let cc = loop(obj[key])
return {
label: key,
children: cc.length ? cc : undefined
}
})
}
具體要什么樣的數據格式,自己在處理
{代碼...} 具體要什么樣的數據格式,自己在處理
關注 1 回答 1
hfhan 回答了問題 · 3月2日
1、刪除上一個點,每次點擊的時候新增點
var icon = L.icon({
iconUrl: "QQ.png",
iconSize: [60, 60],
iconAnchor: [30, 30]
}), marker;
map.on('click',addPoint);
function addPoint(e) {
if(marker)map.removeLayer(marker);
marker = L.marker(e.latlng, {
draggable:false,
riseOnHover: true,
icon
})
.addTo(map)
.bindPopup(e.latlng.toString2()).openPopup();
}
2、就一個點,每次點擊的時候,修改點的位置
var icon = L.icon({
iconUrl: "QQ.png",
iconSize: [60, 60],
iconAnchor: [30, 30]
})
var marker = L.marker(e.latlng, {
draggable:false,
riseOnHover: true,
icon
}).addTo(map)
map.on('click',movePoint);
function movePoint(e) {
marker.setLatLng(e.latlng).bindPopup(e.latlng.toString2()).openPopup()
}
1、刪除上一個點,每次點擊的時候新增點 {代碼...} 2、就一個點,每次點擊的時候,修改點的位置 {代碼...}
關注 1 回答 1
hfhan 回答了問題 · 3月1日
在vue中的事件是經過封裝的,@input
封裝函數的參數$event就是綁定數據的數值,就像下面這樣
對于@input.native
封裝函數的參數$event就是原生事件,就像下面這樣
對于你的寫法,函數中的value指向是環境中的value變量,如果環境中不存在該變量會拋出錯誤的,而你改變的也是環境中的變量value。
所以你可以用下面幾種方法修改
1、使用@input
直接修改accountSetting.amount
<el-input v-model="accountSetting.amount"
@input="accountSetting.amount = $event.replace(/[^\d]/g, '')"></el-input>
或者
<el-input v-model="accountSetting.amount"
@input="accountSetting.amount = accountSetting.amount.replace(/[^\d]/g, '')"></el-input>
2、使用@input.native
直接修改accountSetting.amount
<el-input v-model="accountSetting.amount"
@input.native="accountSetting.amount = $event.target.value.replace(/[^\d]/g, '')"></el-input>
或者
<el-input v-model="accountSetting.amount"
@input.native="accountSetting.amount = accountSetting.amount.replace(/[^\d]/g, '')"></el-input>
<el-input v-model="accountSetting.amount"
@input.native="accountSetting.amount = $event.target.value.replace(/[^\d]/g, '')"></el-input>
3、把你的input事件去掉,改為監聽accountSetting.amount,在回調中處理數據,再重新賦值回去,vue2的寫法:
watch:{
accountSetting.amount: function(value){
this.accountSetting.amount = value.replace(/[^\d]/g, '')
}
}
在vue中的事件是經過封裝的,@input封裝函數的參數$event就是綁定數據的數值,就像下面這樣對于@input.native封裝函數的參數$event就是原生事件,就像下面這樣對于你的寫法,函數中的value指向是環境中的value變量,如果環境中不存在該變量會拋出錯誤的,而你改變的...
關注 0 回答 1
hfhan 回答了問題 · 2月26日
這是從性能優化上考慮的
vue采用微任務隊列去輪詢watcher,連續的兩次改變是同步的,所以回調隊列中只會添加一次回調
這是從性能優化上考慮的vue采用微任務隊列去輪詢watcher,連續的兩次改變是同步的,所以回調隊列中只會添加一次回調
關注 1 回答 1
hfhan 回答了問題 · 2月26日
1、看下事件綁定的時候按鈕是否存在
2、看下按鈕是否被圖片遮擋
1、看下事件綁定的時候按鈕是否存在2、看下按鈕是否被圖片遮擋
關注 5 回答 5
查看全部 個人動態 →
氣象水文綜合數據展示
注冊于 2017-09-14
個人主頁被 13.5k 人瀏覽
推薦關注
我要該,理由是: