Last active
October 28, 2020 20:02
-
-
Save realnot/9b315eaf243a09f6c770b35a50d2cf25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Zone module (nord-ovest, nord-est, centre, sud, islands) | |
*/ | |
// import { REQUEST_SENT, RESPONSE_RECEIVED, REQUEST_SUCCESS, REQUEST_ERROR } from "@/store/types/core/commons"; | |
import * as types from "@/store/types/core/zone"; | |
import { ZoneService } from "@/services"; | |
const state = { | |
options: [], | |
value: null | |
}; | |
... | |
... | |
/* | |
* Region (Tuscany, Sicily, ...) | |
*/ | |
// import { REQUEST_SENT, RESPONSE_RECEIVED, REQUEST_SUCCESS, REQUEST_ERROR } from "@/store/types/core/commons"; | |
import * as types from "@/store/types/core/region"; | |
import { RegionService } from "@/services"; | |
const state = { | |
options: [], | |
value: null | |
}; | |
/* | |
* A component with a form | |
*/ | |
<template> | |
<div class="col-12 col-md-3"> | |
<!-- Zone --> | |
<div class="form-group"> | |
<label class="form-label">Zone</label> | |
<multiselect | |
v-model="value" | |
:options="options" | |
:searchable="false" | |
:close-on-select="true" | |
:show-labels="false" | |
placeholder="Select a zone"> | |
</multiselect> | |
</div> | |
<!-- Region --> | |
<div class="form-group"> | |
<label class="form-label">Region</label> | |
<multiselect | |
v-model="value" | |
:options="options" | |
:searchable="false" | |
:close-on-select="true" | |
:show-labels="false" | |
placeholder="Select a region"> | |
</multiselect> | |
</div> | |
</div> | |
</template> | |
<script> | |
import { mapState, mapActions } from 'vuex' | |
import { CORE_ZONE_AS_CHOICES_REQUEST } from "@/store/types/core/zone"; | |
import { CORE_REGION_AS_CHOICES_REQUEST } from "@/store/types/core/zone"; | |
import { CORE_PROVINCE_AS_CHOICES_REQUEST } from "@/store/types/core/zone"; | |
export default { | |
name: "SiteDetail", | |
data() { | |
return { | |
content: null, | |
selected: null | |
} | |
}, | |
created() { | |
this.CORE_ZONE_AS_CHOICES_REQUEST(); | |
this.CORE_REGION_AS_CHOICES_REQUEST(); | |
this.CORE_PROVINCE_AS_CHOICES_REQUEST(); | |
}, | |
computed: { | |
...mapState(['value', 'options']) | |
}, | |
methods: { | |
...mapActions([ | |
CORE_ZONE_AS_CHOICES_REQUEST, | |
CORE_REGION_AS_CHOICES_REQUEST, | |
CORE_PROVINCE_AS_CHOICES_REQUEST, | |
]), | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment