我希望能夠根據(jù)是否選中單選按鈕來(lái)更改JSON疊加層的樣式。單選按鈕區(qū)域1到區(qū)域5更改顯示的JSON單選按鈕的顏色JSON和顏色靜態(tài)更改JSON樣式我在SetStyle函數(shù)內(nèi)部添加了一個(gè)簡(jiǎn)單的if語(yǔ)句 if (colorjson.checked) { return { fillColor: feature.getProperty('COLOR'), strokeWeight: 1, strokeColor: 'black', fillOpacity: 0.4, strokeOpacity: 1, zIndex: 0 }; } else if (colorstatic.checked) { return { fillColor: '#006d2c', strokeWeight: 1, strokeColor: 'black', fillOpacity: 0.8 }; }有點(diǎn)用。當(dāng)我單擊“靜態(tài)色”單選按鈕并用鼠標(biāo)懸停在覆蓋圖上時(shí),填充色確實(shí)發(fā)生了變化。但是,我希望單擊時(shí)更改JSON的樣式。另外,無(wú)論我選擇哪種樣式(Color JSON或Color Static),我都希望該樣式可以延續(xù)到所有5個(gè)區(qū)域。
Google Maps在復(fù)選框上更改JSON覆蓋樣式
慕運(yùn)維8079593
2021-04-27 15:09:31