Manually handle radio state

This commit is contained in:
2021-09-07 15:20:53 +02:00
parent 9078300037
commit c15cc02a09
2 changed files with 8 additions and 3 deletions

2
dist/js/field.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,12 @@
<div v-if="edit" class="flex block my-2"> <div v-if="edit" class="flex block my-2">
<div v-for="option in routeTypes" class="ml-2"> <div v-for="option in routeTypes" class="ml-2">
<input type="radio" :id="option.value" :value="option.value" v-model="selectedRouteType"> <input
type="radio"
:id="option.value"
:checked="option.value === selectedRouteType"
:value="option.value"
@change="e => selectedRouteType = e.target.value">
<label :for="option.value">{{ option.name }}</label> <label :for="option.value">{{ option.name }}</label>
</div> </div>
</div> </div>
@@ -62,7 +67,7 @@ export default {
.map((marker) => `${marker.lng},${marker.lat}`) .map((marker) => `${marker.lng},${marker.lat}`)
.join(";"); .join(";");
const URL = `https://api.mapbox.com/directions/v5/mapbox/${this.selectedRouteType.value}/${cords}?geometries=geojson&access_token=pk.eyJ1Ijoia2V2aW5taWRib2UiLCJhIjoiY2pydWhlamQyMHJ2NTRhdGN1em5ndXVyMyJ9.Ejdo_3iuuGOD662Bh6es4w`; const URL = `https://api.mapbox.com/directions/v5/mapbox/${this.selectedRouteType}/${cords}?geometries=geojson&access_token=pk.eyJ1Ijoia2V2aW5taWRib2UiLCJhIjoiY2pydWhlamQyMHJ2NTRhdGN1em5ndXVyMyJ9.Ejdo_3iuuGOD662Bh6es4w`;
return fetch(URL) return fetch(URL)
.then((resp) => resp.json()) .then((resp) => resp.json())
.then((response) => response.routes[0].geometry.coordinates) .then((response) => response.routes[0].geometry.coordinates)