Skip to content

Commit

Permalink
vuex global store and component factory
Browse files Browse the repository at this point in the history
  • Loading branch information
dragos-eu committed Oct 25, 2024
1 parent 7c84848 commit 978be3c
Show file tree
Hide file tree
Showing 7 changed files with 1,518 additions and 1,610 deletions.
12 changes: 3 additions & 9 deletions ESPD/examples/procedureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ Vue.component('procedureComponent', {
partII: { A: [], B: [], C: [], D: []}
},
meta_espd_doc: window.raw_data[window.espd_doc.espd_version],
espd_model: window.espd_model,
show: true
espd_model: window.espd_model
}
},

methods: {
updateData(componentdata){
console.log(componentdata)
}
},
created() {
created() {
//Build the UI part for each Criteria
for (const key in this.meta_espd_doc.partI) {
if (Object.hasOwn(this.meta_espd_doc.partI, key)) {
Expand Down Expand Up @@ -137,7 +131,7 @@ Vue.component('procedureComponent', {
</b-card-header>
<b-collapse id="accordion-p7" accordion="my-accordion" role="tabpanel">
<b-card-body v-for="item in espd_structure['partII']['D']">
<component v-bind:is="item" :ref="item" @updatedata="updateData" v-bind:espd_model="espd_model"></component>
<component v-bind:is="item" :ref="item"></component>
</b-card-body>
</b-collapse>
</b-card>
Expand Down
23 changes: 14 additions & 9 deletions ESPD/examples/startComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Vue.component("startComponent", {
let data = await thecall.json()
if (thecall.ok) {
window.espd_model = data
//build the components for this version on demand
//factoryComponents()
}
} catch (error) {
console.log(error)
Expand All @@ -40,9 +42,9 @@ Vue.component("startComponent", {
}
},

beforeDestroy(){
console.log(this.exp);

updated(){
saveData(this.exp)
this.$store.commit('savekv', {key:'start', value:this.exp})
},

created(){
Expand All @@ -64,13 +66,16 @@ Vue.component("startComponent", {
}
this.exp.role = 'ca'
this.exp.country = 'EUR'

window.espd_doc.role = this.exp.role
window.espd_doc.country = this.exp.country
//load the model too
thecall = await fetch(`${window.raw_data[window.espd_doc.espd_version].model.source}`)
data = await thecall.json()
if (thecall.ok) {
window.espd_model = data
window.espd_data = {}
//create the components for this version based on the model
//factoryComponents()
}
}
} catch (error) {
Expand All @@ -91,8 +96,8 @@ Vue.component("startComponent", {
</div>
</b-col>
</b-row>
<b-row>
<b-col>
<b-row>
<b-col>
<div class="accordion" role="tablist">
<b-card no-body class="mb-1">
<b-card-header header-tag="header" class="p-1" role="tab">
Expand All @@ -115,9 +120,9 @@ Vue.component("startComponent", {
</b-collapse>
</b-card>
</div>
</b-col>
</b-row>
</b-container>
</b-col>
</b-row>
</b-container>
</template>
`

Expand Down
Loading

0 comments on commit 978be3c

Please sign in to comment.